https://github.com/matviib/scheduler
Task Scheduler for Laravel applications. UI from scratch
https://github.com/matviib/scheduler
composer-library composer-package cron laravel schedule scheduler task-manager task-scheduler
Last synced: 2 months ago
JSON representation
Task Scheduler for Laravel applications. UI from scratch
- Host: GitHub
- URL: https://github.com/matviib/scheduler
- Owner: MatviiB
- Created: 2018-01-25T11:13:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T07:09:29.000Z (about 6 years ago)
- Last Synced: 2025-03-17T22:06:41.437Z (2 months ago)
- Topics: composer-library, composer-package, cron, laravel, schedule, scheduler, task-manager, task-scheduler
- Language: HTML
- Homepage:
- Size: 54.7 KB
- Stars: 21
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Installation
## First steps
Add Provider for Laravel < 5.5
```
MatviiB\Scheduler\SchedulerServiceProvider::class,
```
Publish config and CronTasksList class files:
```
php artisan vendor:publish
```
and choose "Provider: MatviiB\Scheduler\SchedulerServiceProvider" if requested.Files that must be published:
```
config/scheduler.php
app/Console/CronTasksList.php
```Create database table:
```sh
php artisan migrate
```
## Let's finish setup###### Move your commands from `App\Console\Kernel` schedule() function to new file: `CronTasksList.php` trait.
Add next line to schedule() function instead of list of commands:
```php
schedule($schedule);
}
```
Paste your commands to `app/Console/CronTasksList.php` trait:
```php
command('example:command')->yearly()->withoutOverlapping();
}
}
```If everything done for now you can run next command, it will show your current commands list
```
php artisan scheduler:show
```And you will see something like this
```
Scheduler is disabled.
You see standard tasks list.
+-----------------+------------------------------+-----------+-------------+-----+----------+
| command | description | is_active | expression | w_o | interval |
+-----------------+------------------------------+-----------+-------------+-----+----------+
| command:name | Description for command:name | 1 | 0 * * * * * | 1 | 1 hour |
| example:command | Command description | 1 | * * * * * * | 1 | 1 minute |
+-----------------+------------------------------+-----------+-------------+-----+----------+```
To use Scheduler you need to copy commands to schedulers table.
Note: every `scheduler:create` execution will soft delete old tasks and create fresh commands data.
```
php artisan scheduler:create
```To use Scheduler you need enable it by adding to your `.env` next line:
```sh
SCHEDULER_ENABLED=true
```Let's check status and scheduled tasks:
```
php artisan scheduler:show
```And you will see something like this:
```
Scheduler is enabled.
You see scheduled tasks list configured with Scheduler.
+-----------------+------------------------------+-----------+-------------+-----+----------+
| command | description | is_active | expression | w_o | interval |
+-----------------+------------------------------+-----------+-------------+-----+----------+
| command:name | Description for command:name | 1 | 0 * * * * * | 1 | 1 hour |
| example:command | Command description | 1 | * * * * * * | 1 | 1 minute |
+-----------------+------------------------------+-----------+-------------+-----+----------+
```
# Usage
You can manage your scheduled task on page `/scheduler` by default.Also you are free to configure it yourself in `config/scheduler.php`.
After creating operation you will have your scheduled tasks list and it will ready to work but with scheduler you have some more powerfull things.
1. You can create different tasks for same command with different parameters and run it separately.
On the next screenshot you can see the same scheduled task for generate report with argument user equal 1 and option --client=2 for first task and argument user equal 3 and option --client=4 for next one.
This is how the creating task page looks like:
2. Next powerfull thing - You can run your tasks from UI imediately with different arguments and options.
Next screenshot shows how it works:
## License
Scheduler for Laravel is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).