agence-adeliom / lumberjack-cron
1.0.41
2022-09-13 08:44 UTC
Requires
- php: >=8.0.2
- rareloop/lumberjack-core: ^5.0
This package is auto-updated.
Last update: 2023-01-18 18:06:20 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.