A professional, reusable web installer for any PHP application. Simplify your deployment process with an intuitive step-by-step installation wizard.
- System Requirements Check - Validates PHP version, extensions, and directory permissions
- Database Setup - Automated database creation and schema import
- PHP Migration Support - Execute PHP-based migrations and seeders
- Configuration Management - Generates application config files
- Admin Account Creation - Optional administrator user setup
- Installation Lock - Prevents reinstallation after completion
- CSRF Protection - Secure form handling
- Responsive UI - Bootstrap-powered interface
- Debug Control - Environment-based debug output control
- Error Handling - Comprehensive validation and user feedback
composer require jmrashed/php-installer
# Clone the repository
git clone git@github.com:jmrashed/php-installer.git
# Or download and extract to your project
wget https://github.com/jmrashed/php-installer/archive/main.zip- Copy the
php-installerfolder to your project root - Create your database schema file at
database/db.sql - Configure installer settings in
config/installer.php - Access via browser:
http://yourdomain.com/php-installer/
- PHP 7.4 or higher
- PDO extension
- MySQL/MariaDB database
- Web server (Apache/Nginx)
Edit config/installer.php:
<?php
return [
'app_name' => 'Your Application',
'version' => '1.0.0',
'php_version' => '7.4',
'required_extensions' => ['pdo_mysql', 'curl', 'mbstring'],
'writable_dirs' => ['config', 'storage', 'uploads'],
'database_file' => __DIR__ . '/../database/db.sql',
'migration_support' => true,
'migration_path' => __DIR__ . '/../database/migrations',
'seeder_path' => __DIR__ . '/../database/seeders',
'supported_databases' => [
'mysql' => ['name' => 'MySQL', 'extension' => 'pdo_mysql', 'default_port' => '3306'],
'pgsql' => ['name' => 'PostgreSQL', 'extension' => 'pdo_pgsql', 'default_port' => '5432'],
'sqlite' => ['name' => 'SQLite', 'extension' => 'pdo_sqlite', 'default_port' => null]
]
];Place your SQL schema in database/db.sql:
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);Create PHP migration files in database/migrations/:
<?php
// 2024_01_01_000001_create_users_table.php
return function ($pdo) {
$pdo->exec("
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
");
echo "β
Table 'users' created.\n";
};Create seeder files in database/seeders/:
<?php
// AdminSeeder.php
return function ($pdo) {
$stmt = $pdo->prepare("INSERT INTO users (username, email, password) VALUES (?, ?, ?)");
$stmt->execute(['admin', 'admin@example.com', password_hash('admin123', PASSWORD_DEFAULT)]);
echo "β
Admin user seeded.\n";
};php-installer/
βββ config/
β βββ installer.php # Configuration settings
βββ database/
β βββ db.sql # Database schema
βββ public/
β βββ index.php # Entry point
βββ src/
β βββ Core/ # Core installer classes
β βββ Controllers/ # Request handlers
β βββ Views/ # UI templates
β βββ Assets/ # CSS, JS, images
β βββ Templates/ # Config templates
βββ storage/
βββ logs/ # Installation logs
βββ installer.lock # Installation lock file
// config/installer.php
return [
'app_name' => 'Laravel Application',
'required_extensions' => ['pdo_mysql', 'mbstring', 'openssl', 'tokenizer'],
'writable_dirs' => ['storage', 'bootstrap/cache'],
'migration_support' => true,
'migration_path' => __DIR__ . '/../database/migrations',
'seeder_path' => __DIR__ . '/../database/seeders'
];// config/installer.php
return [
'app_name' => 'Custom PHP App',
'required_extensions' => ['pdo_mysql', 'curl', 'gd'],
'writable_dirs' => ['uploads', 'cache', 'logs'],
'migration_support' => true,
'migration_path' => __DIR__ . '/../database/migrations',
'seeder_path' => __DIR__ . '/../database/seeders'
];During the database import step, users can choose:
-
Run database migrations & seeders (Recommended)
- Executes PHP migration files
- Runs seeder files after migrations
- Provides detailed logging
-
Use default database schema
- Imports from
database/db.sql - Traditional SQL file approach
- Imports from
-
Upload custom SQL file
- Allows custom
.sqlor.zipuploads - Useful for existing database schemas
- Allows custom
Control debug output using your application's .env file:
# Enable debug output during installation
APP_DEBUG=true
# Disable debug output for production
APP_DEBUG=falseAlternatively, add ?debug=1 to any installer URL for temporary debugging.
Extend the installer by modifying src/Core/Installer.php:
private $steps = [
'welcome',
'license',
'system_check',
'db_config',
'db_import',
'app_config',
'admin_account',
'custom_step', // Add your custom step
'finish'
];The installer automatically detects and runs:
- PHP Migrations: Files in
database/migrations/*.php - Seeders: Files in
database/seeders/*.php(run after migrations) - SQL Files: Traditional
.sqlfiles as fallback
Create custom config templates in src/Templates/:
config_template.php- Application configurationenv_template.php- Environment variables
See CHANGELOG.md for a detailed list of changes and version history.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Md Rasheduzzaman
Full-Stack Engineer & Technical Project Manager
- Email: jmrashed@gmail.com
- GitHub: @jmrashed
- LinkedIn: Md Rasheduzzaman
- Bootstrap for the responsive UI framework
- PHP community for best practices and standards
β Star this repository if it helped you!








