https://github.com/eonx-com/schedule-bundle
[READ-ONLY] Provides the Command Scheduling logic of Laravel in a Symfony application
https://github.com/eonx-com/schedule-bundle
Last synced: 6 months ago
JSON representation
[READ-ONLY] Provides the Command Scheduling logic of Laravel in a Symfony application
- Host: GitHub
- URL: https://github.com/eonx-com/schedule-bundle
- Owner: eonx-com
- License: mit
- Archived: true
- Created: 2019-11-26T22:09:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-17T06:30:40.000Z (over 6 years ago)
- Last Synced: 2024-12-27T13:07:31.349Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
EonX - ScheduleBundle
Provides the Command Scheduling logic of Laravel in a Symfony application.
---
## Installation
```bash
$ composer require eonx-com/schedule-bundle
```
Until a recipe is created for this bundle you will need to register it manually:
```php
// config/bundles.php
return [
// Other bundles...
EonX\ScheduleBundle\ScheduleBundle::class => ['all' => true],
];
```
## Usage
### Register Your Scheduled Commands
To register the scheduled commands this bundle implements a concept of "schedule providers", thanks to Symfony's
autoconfigure feature, the only thing required is to create services that implement `EonX\ScheduleBundle\Interfaces\ScheduleProviderInterface`.
The `ScheduleInterface` passed to the `schedule` method offers all the features of the [Laravel Console Scheduling][1].
```php
// 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();
}
}
}
```
### Run The Schedule
This bundle providers a console command to run the schedule:
```bash
$ php bin/console schedule:run
```
[1]: https://laravel.com/docs/5.8/scheduling