-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# CodeIgniter Queue | ||
|
||
Queues for the CodeIgniter 4 framework. | ||
|
||
[![PHPUnit](https://github.com/michalsn/codeigniter-queue/actions/workflows/phpunit.yml/badge.svg)](https://github.com/michalsn/codeigniter-queue/actions/workflows/phpunit.yml) | ||
[![PHPStan](https://github.com/michalsn/codeigniter-queue/actions/workflows/phpstan.yml/badge.svg)](https://github.com/michalsn/codeigniter-queue/actions/workflows/phpstan.yml) | ||
[![Deptrac](https://github.com/michalsn/codeigniter-queue/actions/workflows/deptrac.yml/badge.svg)](https://github.com/michalsn/codeigniter-queue/actions/workflows/deptrac.yml) | ||
[![Coverage Status](https://coveralls.io/repos/github/michalsn/codeigniter-queue/badge.svg?branch=develop)](https://coveralls.io/github/michalsn/codeigniter-queue?branch=develop) | ||
|
||
![PHP](https://img.shields.io/badge/PHP-%5E8.1-blue) | ||
![CodeIgniter](https://img.shields.io/badge/CodeIgniter-%5E4.3-blue) | ||
|
||
## Installation | ||
|
||
composer require michalsn/codeigniter-queue | ||
|
||
Migrate your database: | ||
|
||
php spark migrate --all | ||
|
||
## Configuration | ||
|
||
Publish configuration file: | ||
|
||
php spark queue:publish | ||
|
||
Create your first Job: | ||
|
||
php spark queue:job Example | ||
|
||
Add it to the `$jobHandlers` array in the `app\Config\Queue.php` file: | ||
|
||
```php | ||
// ... | ||
|
||
use App\Jobs\Example; | ||
|
||
// ... | ||
|
||
public array $jobHandlers = [ | ||
'my-example' => Example::class | ||
]; | ||
|
||
// ... | ||
``` | ||
|
||
## Basic usage | ||
|
||
Add job to the queue: | ||
|
||
```php | ||
service('queue')->push('queueName', 'my-example', ['data' => 'array']); | ||
``` | ||
|
||
Run the queue worker: | ||
|
||
php spark queue:work queueName | ||
|
||
## Docs | ||
|
||
https://michalsn.github.io/codeigniter-queue/ |