1. Go to this page and download the library: Download matviib/scheduler 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/ */
matviib / scheduler example snippets
namespace App\Console;
use MatviiB\Scheduler\Console\Kernel as SchedulerKernel;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
..
..
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// make changes just here
// cut your commands from here
// and write next line
with(new SchedulerKernel())->schedule($schedule);
}
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
/**
* Trait CronTasksList
*
* To use: uncomment all lines and copy your commands list
* from app/Console/Kernel.php schedule() to tasks() function.
*
* @package App\Console
*/
trait CronTasksList
{
public function tasks(Schedule $schedule)
{
// paste your commands here
$schedule->command('example:command')->yearly()->withoutOverlapping();
}
}