PHP code example of ashallendesign / laravel-executor
1. Go to this page and download the library: Download ashallendesign/laravel-executor 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/ */
ashallendesign / laravel-executor example snippets
namespace App\Executor;
use AshAllenDesign\LaravelExecutor\Classes\Executor;
class AppUpdate extends Executor
{
public function run(): Executor
{
return $this->runArtisan('cache:clear');
}
}
namespace App\Executor;
use AshAllenDesign\LaravelExecutor\Classes\Executor;
class AppUpdate extends Executor
{
public function run(): Executor
{
return $this->runExternal('composer install');
}
}
namespace App\Executor;
use AshAllenDesign\LaravelExecutor\Classes\Executor;
class AppUpdate extends Executor
{
public function run(): Executor
{
return $this->runClosure(function () {
return 'I am running inside a closure.';
});
}
}
namespace App\Executor;
use AshAllenDesign\LaravelExecutor\Classes\Executor;
class AppUpdate extends Executor
{
public function run(): Executor
{
return $this->simpleDesktopNotification('Notification title', 'Notification body');
}
}
namespace App\Executor;
use AshAllenDesign\LaravelExecutor\Classes\Executor;
class AppUpdate extends Executor
{
public function run(): Executor
{
return $this->ping('https://ashallendesign.co.uk/executor-webhook-route');
}
}
namespace App\Executor;
use AshAllenDesign\LaravelExecutor\Classes\Executor;
class AppUpdate extends Executor
{
public function run(): Executor
{
return $this->ping('https://ashallendesign.co.uk/executor-webhook-route', [
'X-Webhook-Signature' => 'secret-signature-to-go-here'
]);
}
}
namespace App\Http\Controllers;
use App\Executor\AppInstall;
class Controller
{
public function index()
{
(new AppInstall())->run();
}
}
namespace App\Executor;
use AshAllenDesign\LaravelExecutor\Classes\Executor;
class AppUpdate extends Executor
{
public function run(): Executor
{
return $this->simpleDesktopNotification('Starting Executor', 'Starting the AppUpdate Executor.')
->runExternal('composer install')
->runArtisan('migrate')
->runArtisan('cache:clear')
->completeNotification();
}
}