Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/y4roc/schedule-bundle
This bundle offers you the possibility to add console commands to a cronjob with a simple function.
https://github.com/y4roc/schedule-bundle
Last synced: about 12 hours ago
JSON representation
This bundle offers you the possibility to add console commands to a cronjob with a simple function.
- Host: GitHub
- URL: https://github.com/y4roc/schedule-bundle
- Owner: y4roc
- License: mit
- Created: 2020-02-24T14:07:37.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-02-24T18:50:49.000Z (over 4 years ago)
- Last Synced: 2024-04-06T16:02:19.098Z (8 months ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Schedule-Bundle
This bundle offers you the possibility to add console commands to a cronjob with a simple function.
## Installation
```bash
composer req thhan/schedule-bundle
```Register this bundle manually.
```php
// config/bundles.phpreturn [
// Other bundles...
Thhan\ScheduleBundle\ScheduleBundle::class => ['all' => true],
];
```## Server configuration
Finally you create a cronjob on the server that executes the "schedule:run" command every minute.
```text
* * * * * {path_to_symfony}/bin/console schedule:run >> /dev/null 2>&1
```## Usage
Add the Trait Schedule class to your console command. Extend the configuration function with the function "addCron". As parameter you pass a string or an array of strings with the formatting of cron jobs.
```php
use Thhan\ScheduleBundle\Command\Schedule;class YourCommand extends Command {
use Schedule;public function configure() {
$this->setName('app:test')
->addCron('30 3 * * *')
->addCron([
'*/10 * * * *',
'0 22 * * 1'
]);
}
}
```## Planned
- add jobs via configuration
- add logger for output