PHP code example of cossou / eventcron
1. Go to this page and download the library: Download cossou/eventcron 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/ */
cossou / eventcron example snippets
'providers' => [
…
'Cossou\EventCRON\EventCRONServiceProvider'
]
'aliases' => [
…
'EventCRON' => 'Cossou\EventCRON\Facades\EventCRON'
]
EventCRON::queue('myevent');
App::make('eventcron')->queue('myevent');
$eventcron = new Cossou\EventCRON\EventCRONManager();
$eventcron->queue('myevent');
EventCRON::queue('myevent');
Event::listen('myevent', function()
{
echo 'myevent just got fired!';
});
EventCRON::queue('myevent', ['string', $variable, 12, new Object()]);
Event::listen('myevent', function($string, $variable, $number, $object)
{
echo 'myevent just got fired with some neat arguments';
dd($string, variable, $number, $object);
});
EventCRON::queue('myevent', NULL, Carbon\Carbon::now()->addHour());
EventCRON::flush('myevent');
EventCRON::flushAll();
php artisan migrate --package=cossou/eventcron
php artisan migrate:publish cossou/eventcron
php artisan migrate
php artisan eventcron:trigger myevent
*/1 * * * * php /var/www/myproject/artisan eventcron:trigger:all
php artisan config:publish cossou/eventcron