bearframework / tasks-addon
Tasks addon for Bear Framework
Installs: 1 985
Dependents: 5
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/bearframework/tasks-addon
Requires
- php: 8.0.*|8.1.*|8.2.*|8.3.*|8.4.*
- bearframework/bearframework: 1.*
- ivopetkov/locks-bearframework-addon: 1.*
Requires (Dev)
- dev-master
- v1.5.0
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.1
- v1.0.0
- v0.4.15
- v0.4.14
- v0.4.13
- v0.4.12
- v0.4.11
- v0.4.10
- v0.4.9
- v0.4.8
- v0.4.7
- v0.4.6
- v0.4.5
- v0.4.4
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.8
- v0.3.7
- v0.3.6
- v0.3.5
- v0.3.4
- v0.3.3
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
This package is auto-updated.
Last update: 2025-10-26 05:19:12 UTC
README
A lightweight task scheduling and execution addon for Bear Framework. It lets you register task handlers, enqueue work items with scheduling and priority options, and process them via a runnable worker.
Snippets
Define task (register handler)
$app->tasks ->define('definition-id', function ($value): void { // code })
Add task
$app->tasks ->add('definition-id', 'example-value', [ 'id' => 'task-id', // optional 'listID' => '', // empty value for the default list 'startTime' => time() + 120, // start in 2 minutes 'priority' => 3, // 1 - lowest, 5 - highest 'ignoreIfExists' => true, // will check the id only ]);
Run tasks
$app->tasks ->addEventListener('runTask', function (\BearFramework\Tasks\RunTaskEventDetails $eventDetails) use ($app) { $app->logs->log('run-task', $eventDetails->definitionID); }) ->run([ 'listID' => '', 'maxExecutionTime' => 30 ]);
Contributing
Contributions and bug reports are welcome. Open issues or submit pull requests to the repository.
License
This addon is free to use under the MIT license. See the LICENSE file for details.