PHP code example of biohazard / laravel-schedule
1. Go to this page and download the library: Download biohazard/laravel-schedule 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/ */
biohazard / laravel-schedule example snippets
...
use Biohazard\Kernel as ConsoleKernel;
...
class Kernel extends ConsoleKernel
{
...
protected function schedule(Schedule $schedule): void
{
$schedule->commands(
'command1',
'command2',
'command3',
)->name('Name')
->storeOutput()
->onSuccess(function (Stringable $output) {
echo 'Schedule task output success '. $output;
})->onFailure(function (Stringable $output) {
echo 'Schedule task output failured '. $output;
})
->dailyAt('20:00')
->run();
$schedule->jobs(
new Job1,
new Job2,
new Job3,
)->name('Name')
->dailyAt('21:00')
->run();
}
...
}