PHP code example of sajidifti / laravel-command-center

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

    

sajidifti / laravel-command-center example snippets


return [
    // Route prefix for accessing the Command Center
    'route_prefix' => env('LARAVEL_COMMAND_CENTER_ROUTE_PREFIX', 'command-center/secret'),
    
    // Authentication credentials
    'username' => env('LARAVEL_COMMAND_CENTER_USERNAME', 'admin'),
    'password' => env('LARAVEL_COMMAND_CENTER_PASSWORD', 'password'),
    
    // Session configuration
    'session' => [
        'lifetime' => env('LARAVEL_COMMAND_CENTER_SESSION_LIFETIME', 120),  // minutes
        'path' => storage_path('framework/management_sessions'),
        'cookie' => 'laravel_command_center_session_id',
        'gc_probability' => 2,  // 2% chance of garbage collection
    ],
];

'system_info_items' => [
    [
        'key' => 'php_version',
        'label' => 'PHP Version',
        'icon' => 'heroicon-o-code-bracket',
        'value' => fn() => PHP_VERSION,
    ],
    // Add your own custom system info items
],

'env_settings_categories' => [
    [
        'key' => 'app',
        'name' => 'Application Settings',
        'icon' => 'heroicon-o-cog-6-tooth',
        'fields' => [
            [
                'key' => 'APP_NAME',
                'label' => 'Application Name',
                'type' => 'text'
            ],
            // Add more fields
        ],
    ],
    // Add your own custom categories
],

'command_sections' => [
    [
        'name' => 'Optimization Commands',
        'icon' => 'heroicon-o-bolt',
        'color' => 'blue',
        'commands' => [
            [
                'title' => 'Optimize Application',
                'description' => 'optimize',
                'command' => 'optimize',
                'color' => 'blue',
            ],
            // Add more commands
        ],
    ],
    // Add your own custom sections
],

'allowed_commands' => [
    'optimize',
    'cache:clear',
    'migrate',
    // Add your custom commands here
],

// config/command-center.php
'session' => [
    'path' => storage_path('custom/session/path'),
],

$middleware->alias([
    'command-center.custom' => \App\Http\Middleware\CustomCommandCenterMiddleware::class,
]);

use Illuminate\Support\Facades\Schedule;

Schedule::command('command-center:clean-sessions')->daily();
bash
php artisan command-center:install
bash
php artisan command-center:install
bash
php artisan command-center:install

⚠ Configuration not published
To publish the configuration file manually, run:
  php artisan vendor:publish --tag=command-center-config
bash
php artisan command-center:clean-sessions