PHP code example of relayercore / laravel-installer
1. Go to this page and download the library: Download relayercore/laravel-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/ */
relayercore / laravel-installer example snippets
return [
'name' => env('APP_NAME', 'My App'),
// Path to your logo (relative to public/)
'logo' => '/images/logo.png',
// Custom favicon (defaults to asset('favicon.png'))
'favicon' => asset('favicon.png'),
// Define the exact order of installation steps
'steps' => [
\RelayerCore\LaravelInstaller\Steps\CheckRequirements::class,
\RelayerCore\LaravelInstaller\Steps\CheckPermissions::class,
\RelayerCore\LaravelInstaller\Steps\ConfigureEnvironment::class,
\RelayerCore\LaravelInstaller\Steps\RunMigrations::class,
\RelayerCore\LaravelInstaller\Steps\CreateAdmin::class,
],
// Hook: Assign roles or permissions after the admin is created
'on_admin_created' => function ($user) {
$user->assignRole('super-admin');
},
// Hook: Run logic when the installer completely finishes
'after_install' => function () {
\Artisan::call('cache:clear');
},
];
namespace App\Installer\Steps;
use RelayerCore\LaravelInstaller\Contracts\InstallerStep;
class SelectPlan implements InstallerStep
{
public function id(): string { return 'plan'; }
public function label(): string { return 'Select Plan'; }
public function view(): string { return 'installer.steps.plan'; }
public function isSkipped(): bool { return false; }
public function validate(array $data = []): bool
{
// Add your validation rules
return !empty($data['plan']);
}
public function process(array $data = []): void
{
// Process and save the selected plan to the database or .env
}
}