agence-adeliom / lumberjack-cron
1.0.57
2023-05-30 09:00 UTC
Requires
- php: >=8.0.2
- rareloop/lumberjack-core: ^5.0|^6.0
This package is auto-updated.
Last update: 2026-06-20 20:40:57 UTC
README
Register WordPress scheduled tasks.
Requirements
- PHP 8.0 or greater
- Composer
- Lumberjack
Installation
composer require agence-adeliom/lumberjack-cron
# Copy the configuration file
cp vendor/agence-adeliom/lumberjack-cron/config/crons.php web/app/themes/YOUR_THEME/config/crons.php
Register the service provider into web/app/themes/YOUR_THEME/config/app.php
'providers' => [ ... \Adeliom\Lumberjack\Cron\CronProvider::class ]
Usage
<?php namespace App\Tasks; use Adeliom\Lumberjack\Cron\Cron; class ExampleCronEvent extends Cron { public $every = [ 'seconds' => 30, 'minutes' => 15, 'hours' => 1, ]; public function handle(){ update_option('last_ran', current_time('mysql')); } }
Register the task into your config file web/app/themes/YOUR_THEME/config/crons.php :
return [ 'register' => [ ... App\Tasks\ExampleCronEvent::class ], ];
License
Lumberjack Cron is released under the MIT License.