PHP code example of nazmulcreator / laravel-web-installer

1. Go to this page and download the library: Download nazmulcreator/laravel-web-installer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nazmulcreator / laravel-web-installer example snippets


return [
    'steps' => [
        'welcome',
        'p_connection' => 'installer',
];

  // In config/installer.php or via environment:
  'route_prefix' => 'setup',  // Now accessible at /setup
  

'route_prefix' => 'very-secret-path-12345',

Artisan::call('migrate', ['--force' => true]);
Artisan::call('key:generate', ['--force' => true]);
Artisan::call('cache:clear');

// Reads current .env
$content = file_get_contents($envPath);

// Updates or appends values
foreach ($values as $key => $val) {
    $pattern = "/^{$key}=.*$/m";
    if (preg_match($pattern, $content)) {
        $content = preg_replace($pattern, "{$key}={$val}", $content);
    } else {
        $content .= PHP_EOL . "{$key}={$val}";
    }
}

// Writes updated .env
file_put_contents($envPath, $content);
bash
php artisan vendor:publish --tag=installer-config
php artisan vendor:publish --tag=installer-assets
bash
  php artisan vendor:publish --tag=installer-assets --force
  # Edit: public/vendor/laravel-web-installer/installer.css
  

laravel-web-installer/
├── composer.json
├── src/
│  ├── LaravelWebInstallerServiceProvider.php
│  ├── Http/
│  │  ├── Controllers/
│  │  │  ├── InstallController.php
│  │  │  └── FinalizeController.php
│  │  └── Requests/
│  │     └── DatabaseSetupRequest.php
│  ├── Models/
│  │  └── Installation.php
│  └── Resources/
│     ├── views/
│     │  ├── layout.blade.php
│     │  ├── welcome.blade.php
│     │  ├── 
bash
php artisan test tests/Feature/InstallTest.php
bash
# Traditional (e
php artisan key:generate
php artisan cache:clear