PHP code example of awaisjameel / laravel-cpanel-hosting

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

    

awaisjameel / laravel-cpanel-hosting example snippets


// config/cpanel-hosting.php
'pipeline' => [
    'default_steps' => [
        'sync-env',
        'maintenance-down',
        'artisan:cache:clear',
        'migrate',
        ['command' => 'db:seed', 'parameters' => ['--class' => 'ProductionSeeder', '--force' => true]],
        'cache',
        'storage-link',
        fn () => Http::post('https://hooks.slack.com/...', ['text' => 'Deploy finished!'])->successful(),
        'maintenance-up',
    ],
    'stop_on_failure' => true,
],

use Awaisjameel\LaravelCpanelHosting\Events\{DeployStarting, DeployStepCompleted, DeployCompleted};

Event::listen(DeployStarting::class, function (DeployStarting $event) {
    // $event->steps, $event->ip
});

Event::listen(DeployStepCompleted::class, function (DeployStepCompleted $event) {
    // $event->step, $event->result
});

Event::listen(DeployCompleted::class, function (DeployCompleted $event) {
    // $event->success, $event->steps
});

use Awaisjameel\LaravelCpanelHosting\Facades\LaravelCpanelHosting;

LaravelCpanelHosting::isEnabled();    // bool
LaravelCpanelHosting::routePrefix();  // string
bash
php artisan cpanel-hosting:install
bash
php artisan cpanel-hosting:install --no-interaction
bash
php artisan vendor:publish --tag="cpanel-hosting-config"