PHP code example of eonx-com / schedule-bundle

1. Go to this page and download the library: Download eonx-com/schedule-bundle 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/ */

    

eonx-com / schedule-bundle example snippets


// config/bundles.php

return [
    // Other bundles...
    
    EonX\ScheduleBundle\ScheduleBundle::class => ['all' => true],
];

// src/Schedule/MyScheduleProvider.php

use EonX\ScheduleBundle\Interfaces\ScheduleProviderInterface;

final class MyScheduleProvider implements ScheduleProviderInterface
{
    /**
     * Schedule command on given schedule.
     *
     * @param \EonX\ScheduleBundle\Interfaces\ScheduleInterface $schedule
     *
     * @return void
     */
    public function schedule(ScheduleInterface $schedule): void
    {
        $schedule
            ->command('poc:hello-world', ['-v'])
            ->everyMinute()
            ->setMaxLockTime(120);
    
        $schedule
            ->command('poc:hello-world-2')
            ->everyFiveMinutes();
        }
    }
}