https://github.com/antonioribeiro/l4cron
A simple cron job solution for laravel 4
https://github.com/antonioribeiro/l4cron
Last synced: 8 months ago
JSON representation
A simple cron job solution for laravel 4
- Host: GitHub
- URL: https://github.com/antonioribeiro/l4cron
- Owner: antonioribeiro
- License: mit
- Created: 2013-02-02T14:59:54.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-02-02T15:00:24.000Z (over 12 years ago)
- Last Synced: 2025-01-06T01:43:46.748Z (9 months ago)
- Language: PHP
- Size: 93.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# l4cron
A simple Cron job solution fro laravel 4
## Installation
**NB!** This package is not on composer yet. If you want to try it clone it into a workbench folder.add the service provider in `app/config/app.php`
```php
//...
'providers' => array(
//...
'Buhl\Cron\CronServiceProvider',
),
//...
```
`src/config/config.php` constains the following settings
```php
array(
'route' => 'buhl/cron', //the route cron can be call through
'key' => null, //when set. cron will only run when the route has the key in it /buhl/cront/
);
```
##Using
When the cron route is hit _l4cron_ issues an `cron.run` event. you can listen to it and have it run you cron job if its due like so
```php
$this->app['events']->listen('cron.run',function($event)
{
$event->cron->run('*/2 * * * *',function($cron)
{
//I run every other minute
});
$event->cron->run('@daily',function($cron)
{
//I run daily
});
});
```
_l4cron_ uses [cron-expression](https://github.com/mtdowling/cron-expression) to validate the cron expression and passes the object to the callback.enjoy!