Installation
Composer
composer require crustum/cakephp-schedulingLoad the Plugin
Ensure the Scheduling Plugin is loaded in your src/Application.php file (or via bin/cake plugin load Crustum/Scheduling):
$this->addPlugin(\Crustum\Scheduling\SchedulingPlugin::class);Load SignalHandler Plugin (Required)
The Scheduling plugin requires the SignalHandler plugin for graceful termination support:
$this->addPlugin(\SignalHandler\SignalHandlerPlugin::class);The plugin automatically registers the scheduling services and integrates with CakePHP's console system and event manager. No additional configuration is required for basic scheduling functionality.
Install Configuration (Plugin Manifest)
After the plugin is registered, install published assets with the Plugin Manifest system:
bin/cake manifest install --plugin Crustum/SchedulingThis will:
- Copy monitoring migrations into the application's
config/Migrationsdirectory - Create
config/scheduling.php(copy-safe; will not overwrite an existing file) - Append loading of
config/scheduling.phptoconfig/bootstrap.phpwhen the file exists
You can then run migrations for monitoring features:
bin/cake migrations migrateAlternatively, migrate from the plugin path without publishing:
bin/cake migrations migrate -p Crustum/SchedulingPublished migrations and config/scheduling.php support:
monitored_scheduled_tasks— task metadata and statusmonitored_scheduled_task_log_items— execution logs with metadata- Monitoring options (
delete_log_items_older_than_days,grace_time_in_minutes, etc.)
Platform Support
The plugin works on all platforms supported by CakePHP:
- Linux: Full support with all features
- Windows: Full support with all features
- macOS: Full support with all features
The plugin uses the SignalHandler plugin for cross-platform signal handling, ensuring consistent behavior across all operating systems.
Requirements Verification
The plugin automatically checks for required dependencies:
- CakePHP 5.0+ framework
- PHP 8.4+ runtime
- SignalHandler plugin for graceful termination
- Access to system commands for shell execution tasks
If any requirements are missing, the plugin will provide clear error messages during initialization.
Automatic Integration
The plugin automatically integrates with CakePHP's systems:
- Registers scheduling services in the dependency injection container
- Integrates with CakePHP's console command system
- Connects to the event manager for task lifecycle events
- Provides commands for running and managing scheduled tasks
- Sets up signal handling for graceful termination
No manual configuration is required for basic scheduling functionality.
Configuration Options
The plugin supports optional configuration for advanced use cases:
- Cache configuration for task overlap prevention
- Timezone settings for scheduled tasks
- Event listener registration for custom monitoring
- Mutex implementations for single-server execution
For detailed configuration options, see the Integration documentation.
Verification
To verify the plugin is installed correctly, run:
bin/cake --helpYou should see the following scheduling commands available:
schedule run- Run scheduled tasks (typically called by cron)schedule work- Run the scheduler continuously for developmentschedule list- List all scheduled tasksschedule pause- Pause scheduled task processingschedule resume- Resume scheduled task processing after a pauseschedule interrupt- Interrupt the current schedule run (sub-minute loop)schedule test- Test scheduled task executionschedule finish- Finish a scheduled task executionschedule clear- Clear scheduling cacheschedule monitor list- List all scheduled tasksschedule monitor prune- Prune scheduled tasksschedule monitor sync- Sync scheduled tasks
Next Steps
After installation, proceed to the Integration guide to learn how to define and configure your scheduled tasks.