Skip to content

Commit 0432942

Browse files
committed
feat: Add laravel 11 support and replace phpcs with pint
1 parent e784638 commit 0432942

21 files changed

+176
-168
lines changed

.github/workflows/styling.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
name: Check & fix styling
22

3-
on: [ push ]
3+
on: [push]
44

55
jobs:
66
styling:
77
runs-on: ubuntu-latest
88

99
steps:
1010
- name: Checkout code
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v4
1212
with:
1313
ref: ${{ github.head_ref }}
14-
15-
- name: Run PHP CS Fixer
16-
uses: docker://oskarstark/php-cs-fixer-ga
14+
- name: Set up PHP
15+
uses: shivammathur/setup-php@v2
1716
with:
18-
args: --allow-risky=yes
17+
php-version: 8.1
18+
- name: Install Composer
19+
run: composer install --no-interaction
20+
- name: Run Laravel Pint
21+
run: composer format
1922

2023
- name: Commit changes
2124
uses: stefanzweifel/git-auto-commit-action@v4

.github/workflows/tests.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
php: [ "8.1", "8.0", "8.2" ]
15-
laravel: [ "^9.0", '^10.0' ]
16-
dependency-version: [ prefer-lowest, prefer-stable ]
14+
php: [8.1, 8.2]
15+
laravel: [9.*, 10.*, 11.*]
16+
dependency-version: [prefer-stable]
17+
include:
18+
- laravel: 11.*
19+
testbench: 9.*
20+
- laravel: 10.*
21+
testbench: 8.*
22+
- laravel: 9.*
23+
testbench: 7.*
1724
exclude:
18-
- php: "8.0"
19-
laravel: "^10.0"
25+
- laravel: 11.*
26+
php: 8.1
2027

2128
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
2229

.github/workflows/update-changelog.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: "Update Changelog"
22

33
on:
44
release:
5-
types: [ released ]
5+
types: [released]
66

77
jobs:
88
update:
99
runs-on: ubuntu-latest
1010

1111
steps:
1212
- name: Checkout code
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v4
1414
with:
1515
ref: main
1616

.php-cs-fixer.dist.php

-39
This file was deleted.

README.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ php artisan vendor:publish --provider="YieldStudio\LaravelMailjetNotifier\Mailje
4949

5050
namespace App\Notifications;
5151

52-
use Illuminate\Notifications\Notification;
53-
use YieldStudio\LaravelMailjetNotifier\MailjetEmailChannel;
52+
use Illuminate\Notifications\Notification;use YieldStudio\LaravelMailjetNotifier\Channels\MailjetEmailChannel;
5453

5554
class OrderConfirmation extends Notification
5655
{
@@ -77,9 +76,7 @@ class OrderConfirmation extends Notification
7776

7877
namespace App\Notifications;
7978

80-
use Illuminate\Notifications\Notification
81-
;use YieldStudio\LaravelMailjetNotifier\MailjetSmsChannel;
82-
use YieldStudio\LaravelMailjetNotifier\MailjetSmsMessage;
79+
use Illuminate\Notifications\Notification;use YieldStudio\LaravelMailjetNotifier\Channels\MailjetSmsChannel;use YieldStudio\LaravelMailjetNotifier\Messages\MailjetSmsMessage;
8380

8481
class ResetPassword extends Notification
8582
{

composer.json

+15-9
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,26 @@
1919
"email": "james@yieldstudio.fr",
2020
"homepage": "https://yieldstudio.fr",
2121
"role": "Developer"
22+
},
23+
{
24+
"name": "Arthur Monney",
25+
"email": "arthur.monney@yieldstudio.fr",
26+
"homepage": "https://yieldstudio.fr",
27+
"role": "Developer"
2228
}
2329
],
2430
"require": {
25-
"php": "^8.0",
26-
"illuminate/support": "^9|^10",
27-
"illuminate/database": "^9|^10",
28-
"mailjet/mailjet-apiv3-php": "^1.5"
31+
"php": "^8.1|^8.2",
32+
"illuminate/database": "^9|^10|^11",
33+
"illuminate/support": "^9|^10|^11",
34+
"mailjet/mailjet-apiv3-php": "^1.6"
2935
},
3036
"require-dev": {
3137
"ciareis/bypass": "^1.0",
32-
"friendsofphp/php-cs-fixer": "^3.8",
33-
"orchestra/testbench": "7.*|8.*",
34-
"pestphp/pest": "^1.21",
35-
"phpunit/phpunit": "^9.1"
38+
"laravel/pint": "^1.16",
39+
"orchestra/testbench": "^7.44|^8.25|^9.0",
40+
"pestphp/pest": "^2.34",
41+
"phpunit/phpunit": "^9.5|^10.5"
3642
},
3743
"autoload": {
3844
"psr-4": {
@@ -45,7 +51,7 @@
4551
}
4652
},
4753
"scripts": {
48-
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
54+
"format": "vendor/bin/pint",
4955
"test": "vendor/bin/pest",
5056
"post-autoload-dump": [
5157
"@php ./vendor/bin/testbench package:discover --ansi"

config/mailjet.php

+51-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,66 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
return [
6+
7+
/*
8+
|--------------------------------------------------------------------------
9+
| API Token
10+
|--------------------------------------------------------------------------
11+
|
12+
| Your API Key & Secret from https://mailjet.com
13+
|
14+
*/
15+
416
'key' => env('MAILJET_APIKEY', ''),
517
'secret' => env('MAILJET_APISECRET', ''),
6-
'smsToken' => env('MAILJET_SMSTOKEN'),
18+
19+
/*
20+
|--------------------------------------------------------------------------
21+
| Email Sender
22+
|--------------------------------------------------------------------------
23+
|
24+
| Email and Name used by Mailjet when sending email.
25+
| This configuration is used when sending mail.
26+
|
27+
*/
28+
729
'emailFrom' => [
830
'Email' => env('MAIL_FROM_ADDRESS'),
931
'Name' => env('MAIL_FROM_NAME'),
1032
],
33+
34+
/*
35+
|--------------------------------------------------------------------------
36+
| SMS Sender
37+
|--------------------------------------------------------------------------
38+
|
39+
| Defines the name that will be used as the "from" for all outgoing text messages
40+
|
41+
*/
42+
1143
'smsFrom' => env('MAILJET_SMS_SENDER'),
44+
'smsToken' => env('MAILJET_SMSTOKEN'),
45+
46+
/*
47+
|--------------------------------------------------------------------------
48+
| Dry
49+
|--------------------------------------------------------------------------
50+
|
51+
*/
52+
1253
'dry' => (bool) env('MAILJET_DRY', false),
54+
55+
/*
56+
|--------------------------------------------------------------------------
57+
| Options
58+
|--------------------------------------------------------------------------
59+
|
60+
*/
61+
1362
'options' => [
1463
'version' => 'v3.1',
1564
],
65+
1666
];

pint.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"preset": "laravel",
3+
"rules": {
4+
"concat_space": {
5+
"spacing": "one"
6+
},
7+
"blank_line_before_statement": true,
8+
"declare_strict_types": true
9+
}
10+
}

src/MailjetEmailChannel.php src/Channels/MailjetEmailChannel.php

+4-14
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,17 @@
22

33
declare(strict_types=1);
44

5-
namespace YieldStudio\LaravelMailjetNotifier;
5+
namespace YieldStudio\LaravelMailjetNotifier\Channels;
66

77
use Illuminate\Database\Eloquent\Model;
88
use Illuminate\Notifications\AnonymousNotifiable;
99
use Illuminate\Notifications\Notification;
10+
use YieldStudio\LaravelMailjetNotifier\Exceptions\MailjetException;
11+
use YieldStudio\LaravelMailjetNotifier\MailjetService;
1012

1113
class MailjetEmailChannel
1214
{
13-
protected MailjetService $mailjetService;
14-
15-
/**
16-
* Create a new mail channel instance.
17-
*
18-
* @param MailjetService $mailjetService
19-
*
20-
* @return void
21-
*/
22-
public function __construct(MailjetService $mailjetService)
23-
{
24-
$this->mailjetService = $mailjetService;
25-
}
15+
public function __construct(protected MailjetService $mailjetService) {}
2616

2717
/**
2818
* @throws MailjetException

src/MailjetSmsChannel.php src/Channels/MailjetSmsChannel.php

+4-14
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,17 @@
22

33
declare(strict_types=1);
44

5-
namespace YieldStudio\LaravelMailjetNotifier;
5+
namespace YieldStudio\LaravelMailjetNotifier\Channels;
66

77
use Illuminate\Database\Eloquent\Model;
88
use Illuminate\Notifications\AnonymousNotifiable;
99
use Illuminate\Notifications\Notification;
10+
use YieldStudio\LaravelMailjetNotifier\Exceptions\MailjetException;
11+
use YieldStudio\LaravelMailjetNotifier\MailjetService;
1012

1113
final class MailjetSmsChannel
1214
{
13-
protected MailjetService $mailjetService;
14-
15-
/**
16-
* Create a new mail channel instance.
17-
*
18-
* @param MailjetService $mailjetService
19-
*
20-
* @return void
21-
*/
22-
public function __construct(MailjetService $mailjetService)
23-
{
24-
$this->mailjetService = $mailjetService;
25-
}
15+
public function __construct(protected MailjetService $mailjetService) {}
2616

2717
/**
2818
* @throws MailjetException

src/MailjetException.php src/Exceptions/MailjetException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace YieldStudio\LaravelMailjetNotifier;
5+
namespace YieldStudio\LaravelMailjetNotifier\Exceptions;
66

77
use Exception;
88
use Mailjet\Response;

src/MailjetNotifierServiceProvider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function boot(): void
1212
{
1313
if ($this->app->runningInConsole()) {
1414
$this->publishes([
15-
__DIR__.'/../config' => config_path(),
15+
__DIR__ . '/../config' => config_path(),
1616
], 'config');
1717
}
1818
}
@@ -21,7 +21,7 @@ public function register(): void
2121
{
2222
$this->mergeConfigFrom(__DIR__ . '/../config/mailjet.php', 'mailjet');
2323

24-
$this->app->bind(MailjetService::class, function () {
24+
$this->app->bind(MailjetService::class, function (): MailjetService {
2525
$key = config('mailjet.key', '');
2626
$secret = config('mailjet.secret', '');
2727
$smsToken = config('mailjet.smsToken');

0 commit comments

Comments
 (0)