PHP code example of shamimstack / laravel-cms-installer

1. Go to this page and download the library: Download shamimstack/laravel-cms-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/ */

    

shamimstack / laravel-cms-installer example snippets


'providers' => [
    // ...
    shamimstack\Installer\InstallerServiceProvider::class,
],

'license' => [
    'api_url' => env('LICENSE_API_URL', 'https://api.yourservice.com/validate'),
    'api_key' => env('LICENSE_API_KEY', ''),
    'enabled' => env('LICENSE_ENABLED', true),
    'token_path' => storage_path('app/.license'),
],

'database' => [
    'supported_drivers' => ['mysql', 'pgsql', 'sqlite', 'sqlsrv'],
    'default_driver' => 'mysql',
],

'admin' => [
    'model' => App\Models\User::class,
    'role_system' => 'spatie', // or 'column'
    'admin_role_name' => 'admin',
    'role_column' => 'role',
    'admin_email_default' => '[email protected]',
],

'permissions' => [
    'directories' => [
        'storage' => 'writable',
        'bootstrap/cache' => 'writable',
        'public' => 'writable',
    ],
],

'logging' => [
    'channel' => 'installer',
    'retention_days' => 7,
],

// In your service provider or bootstrap file
use shamimstack\Installer\Services\DatabaseManager;
use shamimstack\Installer\Services\AdminManager;

$database = app(DatabaseManager::class);
$admin = app(AdminManager::class);

// Configure database
$database->update([
    'DB_CONNECTION' => 'mysql',
    'DB_HOST' => '127.0.0.1',
    'DB_PORT' => '3306',
    'DB_DATABASE' => 'your_db',
    'DB_USERNAME' => 'root',
    'DB_PASSWORD' => 'password',
]);

// Run migrations
$database->runMigrations();

// Create admin
$admin->create([
    'name' => 'Admin User',
    'email' => '[email protected]',
    'password' => bcrypt('password'),
]);

use shamimstack\Installer\Events\InstallationCompleted;

protected $listen = [
    InstallationCompleted::class => [
        'App\Listeners\SendInstallationNotification',
    ],
];

namespace App\Listeners;

use shamimstack\Installer\Events\InstallationCompleted;

class SendInstallationNotification
{
    public function handle(InstallationCompleted $event): void
    {
        // Send email notification
        // Log to external monitoring
        // Trigger webhook
        // etc.
    }
}
bash
php artisan installer:status