Skip to content

Commit 9fa566d

Browse files
authored
[v1.1.0] Supports Laravel 11 & PHP 8.2, 8.3 (#2)
* Release * Drop Laravel 9 * README * support 2 versions * Bump versions * Bump versions * Use 8.2 * Removed composer.lock * --with-all-dependencies * --with-all-dependencies
1 parent 35b9b51 commit 9fa566d

File tree

6 files changed

+62
-8292
lines changed

6 files changed

+62
-8292
lines changed

.github/workflows/build-laravel.yml

+13-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build & Test (Laravel 9, 10)
1+
name: Build & Test (Laravel 10, 11)
22
env:
33
TESTING_ENV: ${{ secrets.TESTING_ENV }}
44

@@ -16,10 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
version: [
20-
'9',
21-
'10'
22-
]
19+
version: ['10', '11']
2320
runs-on: ubuntu-latest
2421
steps:
2522
- uses: actions/checkout@v3
@@ -28,7 +25,7 @@ jobs:
2825
- name: Setup PHP with coverage driver
2926
uses: shivammathur/setup-php@v2
3027
with:
31-
php-version: 8.1
28+
php-version: 8.2
3229
coverage: pcov
3330

3431
- name: Setup
@@ -40,22 +37,21 @@ jobs:
4037
composer install --no-interaction
4138
echo "$TESTING_ENV" > .env.testing
4239
43-
- name: Laravel 9 composition
44-
if: matrix.version == '9'
40+
- name: Laravel 10 composition
41+
if: matrix.version == '10'
4542
run: |
46-
composer require \
47-
"laravel/framework" "^9" \
48-
"orchestra/testbench" "^7" \
49-
"phpunit/phpunit" "^9" \
50-
"phpunit/php-code-coverage" "^9" \
43+
composer require "laravel/framework" "^10" \
44+
"orchestra/testbench" "^8" \
5145
--with-all-dependencies
5246
53-
- name: Laravel 10 composition
54-
if: matrix.version == '10'
47+
- name: Laravel 11 composition
48+
if: matrix.version == '11'
5549
run: |
56-
composer require "laravel/framework" "^10" --with-all-dependencies
50+
composer require "laravel/framework" "^11" \
51+
"orchestra/testbench" "^9" \
52+
--with-all-dependencies
5753
5854
- name: PHPUnit tests
59-
if: success() && github.event.pull_request.draft == false
55+
if: success()
6056
run: |
6157
composer test

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build & Test (PHP 8.1, 8.2)
1+
name: Build & Test (PHP 8.2, 8.3)
22
env:
33
TESTING_ENV: ${{ secrets.TESTING_ENV }}
44

@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
version: [ '8.1', '8.2' ]
19+
version: [ '8.2', '8.3' ]
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v3
@@ -38,12 +38,12 @@ jobs:
3838
echo "$TESTING_ENV" > .env.testing
3939
4040
- name: PHPUnit tests with coverage
41-
if: success() && github.event.pull_request.draft == false
41+
if: success()
4242
run: |
4343
composer test-coverage
4444
4545
- name: upload coverage to codecov.io
46-
if: success() && matrix.version == '8.1'
46+
if: success() && matrix.version == '8.2'
4747
uses: codecov/codecov-action@v3
4848
with:
4949
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/try-installation.yml

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
name: Try Install Package (Laravel 9 & 10)
1+
name: Try Install Package (Laravel 9, 10, 11)
22
env:
33
LOCAL_ENV: ${{ secrets.LOCAL_ENV }}
44

55
on:
6-
pull_request:
7-
branches:
8-
- 'main'
9-
types: [ opened, synchronize, reopened, ready_for_review ]
10-
push:
11-
branches:
12-
- 'main'
6+
release:
7+
types: [published]
138

149
jobs:
1510
build:
1611
strategy:
1712
fail-fast: false
1813
matrix:
19-
version: [ '^9.0', '^10.0' ]
14+
version: [ '^10.0', '^11.0' ]
2015
runs-on: ubuntu-latest
2116
steps:
22-
- name: Setup PHP with coverage driver
17+
- name: Setup PHP
2318
uses: shivammathur/setup-php@v2
2419
with:
25-
php-version: 8.1
20+
php-version: 8.2
2621
coverage: pcov
2722

2823
- name: Setup and install package on Laravel

README.md

+34-22
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,70 @@
44
[![Total Downloads](http://poser.pugx.org/shipsaas/laravel-priority-queue/downloads)](https://packagist.org/packages/shipsaas/laravel-priority-queue)
55
[![codecov](https://codecov.io/gh/shipsaas/laravel-priority-queue/branch/main/graph/badge.svg?token=V3HOOR12HA)](https://codecov.io/gh/shipsaas/laravel-priority-queue)
66
[![Build & Test](https://github.com/shipsaas/laravel-priority-queue/actions/workflows/build.yml/badge.svg)](https://github.com/shipsaas/laravel-priority-queue/actions/workflows/build.yml)
7-
[![Build & Test (Laravel 9, 10)](https://github.com/shipsaas/laravel-priority-queue/actions/workflows/build-laravel.yml/badge.svg)](https://github.com/shipsaas/laravel-priority-queue/actions/workflows/build-laravel.yml)
7+
[![Build & Test (Laravel 10, 11)](https://github.com/shipsaas/laravel-priority-queue/actions/workflows/build-laravel.yml/badge.svg)](https://github.com/shipsaas/laravel-priority-queue/actions/workflows/build-laravel.yml)
88

9-
A simple Priority Queue Driver for your Laravel Applications.
9+
A simple Priority Queue Driver for your Laravel Applications to serve your priority messages and
10+
makes users happy 🔋.
1011

11-
Laravel Priority Queue Driver uses the `database` driver.
12+
With the famous Repository Pattern of Laravel, Priority Queue Driver is easily get injected into
13+
Laravel's Lifecycle without any hassle/hurdle.
14+
15+
We can use built-in artisan command `php artisan queue:work` 😎.
1216

1317
## Supports
14-
- Laravel 10 (compatible by default)
15-
- Laravel 9 (supports until Laravel drops the bug fixes at [August 8th, 2023](https://laravel.com/docs/10.x/releases))
16-
- PHP 8.1+
18+
- Laravel 11 (supports by default)
19+
- Laravel 10 (supports until Laravel drops the bug fixes at [August 6th, 2024](https://laravel.com/docs/11.x/releases))
20+
- PHP 8.2 & 8.3
21+
- Any database that Laravel supported.
1722

18-
## Architecture
23+
## Architecture Diagram
1924

2025
![Seth Phat - Laravel Priority Queue](https://i.imgur.com/H8OEMhQ.png)
2126

22-
## Why `database`?
23-
24-
- Easy and simple to implement.
25-
- Utilize the `ORDER BY` and `INDEX` for fast queue msgs pop process.
26-
- Super visibility (you can view the jobs and their data in DB).
27-
- Super flexibility (you can change the weight directly in DB to unblock important msgs).
27+
### Why Priority Queue Driver use Database?
2828

29-
## Installation
29+
- Everybody knows Database (MySQL, PgSQL, etc) 👀.
30+
- Easy and simple to implement ❤️.
31+
- Utilize the `ORDER BY` and `INDEX` for fast queue msgs pop process. Faster than any other stuff 🔥.
32+
- Highest visibility (you can view the jobs and their data in DB) ⭐️.
33+
- Highest flexibility (you can change the weight directly in DB to unblock important msgs) 💰.
34+
- No extra tool involved. Just Laravel 🥰.
3035

31-
Install the library:
36+
## Install Laravel Priority Queue
3237

3338
```bash
3439
composer require shipsaas/laravel-priority-queue
3540
```
3641

37-
Export and run the migration:
42+
### One-Time Setup
43+
44+
Export and run the migration (one-time):
3845

3946
```bash
47+
# if you don't need to adjust the migration, don't have to export it
4048
php artisan vendor:publish --tag=priority-queue-migrations
4149
php artisan migrate
4250
```
4351

44-
### One-Time Setup
45-
4652
Open `config/queue.php` and add this into the `connections` array:
4753

4854
```php
55+
'connections' => [
56+
// ... a lot of connections above
57+
// then our lovely guy here
4958
'database-priority' => [
5059
'driver' => 'database-priority',
5160
'connection' => 'mysql',
5261
'table' => 'priority_jobs',
5362
'queue' => 'default',
5463
'retry_after' => 90,
5564
],
65+
],
5666
```
5767

58-
### Note
68+
## Scale/Reliability Consideration
5969

60-
We highly recommend you to use a different database connection (eg `mysql_secondary`) to avoid the worker processes ramming your
70+
It is recommended using a different database connection (eg `mysql_secondary`) to avoid the worker processes ramming your
6171
primary database.
6272

6373
## Usage
@@ -86,7 +96,7 @@ class SendEmail implements ShouldQueue
8696

8797
public function getJobWeight() : int
8898
{
89-
return $this->user->isPro()
99+
return $this->user->isUsingProPlan()
90100
? 1000
91101
: 500;
92102
}
@@ -111,10 +121,12 @@ Queue::connection('database-priority')
111121

112122
## Run The Queue Worker
113123

114-
Nothing different from the Laravel's Doc.
124+
Nothing different from the Laravel Documentation 😎. Just need to include the `database-priority` driver.
115125

116126
```bash
117127
php artisan queue:work database-priority
128+
129+
# Extra win, priority on topic
118130
php artisan queue:work database-priority --queue=custom
119131
```
120132

composer.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "shipsaas/laravel-priority-queue",
33
"type": "library",
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"description": "Priority Queue implementation for your Laravel Applications",
66
"keywords": [
77
"laravel library",
@@ -19,14 +19,14 @@
1919
],
2020
"license": "MIT",
2121
"require": {
22-
"php": "^8.1|^8.2",
23-
"laravel/framework": "^9|^10|dev-master"
22+
"php": "^8.2|^8.3",
23+
"laravel/framework": "^10|^11"
2424
},
2525
"require-dev": {
2626
"fakerphp/faker": "^v1.20.0",
2727
"mockery/mockery": "^1.5.1",
28-
"phpunit/phpunit": "^9|^10",
29-
"orchestra/testbench": "^7|^8",
28+
"phpunit/phpunit": "^10",
29+
"orchestra/testbench": "^8|^9",
3030
"phpunit/php-code-coverage": "^9|^10",
3131
"friendsofphp/php-cs-fixer": "^3.10"
3232
},

0 commit comments

Comments
 (0)