Download the PHP package trogers1884/laravel-schedule-mgt without Composer
On this page you can find all versions of the php package trogers1884/laravel-schedule-mgt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download trogers1884/laravel-schedule-mgt
More information about trogers1884/laravel-schedule-mgt
Files in trogers1884/laravel-schedule-mgt
Package laravel-schedule-mgt
Short Description A Laravel package for managing scheduled tasks through file storage
License MIT
Informations about the package laravel-schedule-mgt
Laravel Schedule Management
A Laravel package for managing scheduled tasks through file storage, allowing dynamic configuration of Laravel's task scheduler without code changes.
Features
- Manage scheduled tasks without modifying code
- Store task configurations in JSON files
- Toggle tasks on/off without deployment
- Add custom parameters and constraints to scheduled tasks
- Command-line interface for task management
- No database dependencies required
Requirements
- PHP 8.1 or higher
- Laravel 10.0 or higher
Installation
You can install the package via composer:
The package will automatically register its service provider.
Configuration
Publish the configuration file:
This will create a config/schedule-mgt.php
file with the following contents:
Laravel Version-Specific Setup
Laravel 11
Add to your routes/console.php
:
Laravel 10
Add to your app/Console/Kernel.php
in the schedule
method:
Important Notes
- For Laravel 10 and above, ensure your
config/app.php
has the package service provider if it's not auto-discovered:
Usage
Managing Tasks via Console Commands
List All Tasks
Add a New Task
Options:
- First argument: The artisan command to schedule
--frequency
: The scheduling frequency (daily, hourly, weekly, etc.)--parameters
: JSON array of command parameters--freq-parameters
: JSON array of frequency method parameters--constraints
: JSON array of additional scheduling constraints--inactive
: Set the task as inactive initially
Toggle Task Status
Remove a Task
This will completely remove the task with ID 1. You'll be asked to confirm before the task is removed. This action cannot be undone.
Frequency Methods
You can use any of Laravel's schedule frequency methods:
hourly()
daily()
weekly()
monthly()
quarterly()
yearly()
timezone()
at()
dailyAt()
twiceDaily()
weeklyOn()
monthly()
monthlyOn()
lastDayOfMonth()
quarterly()
yearly()
cron()
everyMinute()
everyTwoMinutes()
everyThreeMinutes()
everyFourMinutes()
everyFiveMinutes()
everyTenMinutes()
everyFifteenMinutes()
everyThirtyMinutes()
Available Constraints
You can add any of Laravel's schedule constraints:
environments(['production'])
evenInMaintenanceMode()
withoutOverlapping()
onOneServer()
between('8:00', '17:00')
unlessBetween('23:00', '4:00')
when(closure)
skip(closure)
runInBackground()
Example Tasks
Basic Daily Task
Weekly Backup with Parameters
Hourly Task with Multiple Constraints
Testing the Package
Run the test suite:
Uninstallation
To completely remove the package from your Laravel project:
-
Remove your schedule configuration from your Laravel project:
- For Laravel 11: Remove the
ScheduleManager::schedule();
line fromroutes/console.php
- For Laravel 10: Remove the
ScheduleManager::schedule();
line fromapp/Console/Kernel.php
- For Laravel 11: Remove the
-
Remove the published configuration file:
-
Remove the stored task data (optional):
- Uninstall the package via composer:
Security
If you discover any security related issues, please use the issue tracker located at https://github.com/trogers1884/laravel-schedule-mgt/issues .
Credits
- Tom Rogers
- All Contributors
License
The MIT License (MIT). Please see License File for more information.