Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add laravel 11 support and replace phpcs with pint #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/styling.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
name: Check & fix styling

on: [ push ]
on: [push]

jobs:
styling:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
args: --allow-risky=yes
php-version: 8.1
- name: Install Composer
run: composer install --no-interaction
- name: Run Laravel Pint
run: composer format

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
19 changes: 13 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ "8.1", "8.0", "8.2" ]
laravel: [ "^9.0", '^10.0' ]
dependency-version: [ prefer-lowest, prefer-stable ]
php: [8.1, 8.2]
laravel: [9.*, 10.*, 11.*]
dependency-version: [prefer-stable]
include:
- laravel: 11.*
testbench: 9.*
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
exclude:
- php: "8.0"
laravel: "^10.0"
- laravel: 11.*
php: 8.1

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

Expand All @@ -39,7 +46,7 @@ jobs:

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --dev --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --dev --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/pest
4 changes: 2 additions & 2 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: "Update Changelog"

on:
release:
types: [ released ]
types: [released]

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: main

Expand Down
39 changes: 0 additions & 39 deletions .php-cs-fixer.dist.php

This file was deleted.

7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ php artisan vendor:publish --provider="YieldStudio\LaravelMailjetNotifier\Mailje

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use YieldStudio\LaravelMailjetNotifier\MailjetEmailChannel;
use Illuminate\Notifications\Notification;use YieldStudio\LaravelMailjetNotifier\Channels\MailjetEmailChannel;

class OrderConfirmation extends Notification
{
Expand All @@ -77,9 +76,7 @@ class OrderConfirmation extends Notification

namespace App\Notifications;

use Illuminate\Notifications\Notification
;use YieldStudio\LaravelMailjetNotifier\MailjetSmsChannel;
use YieldStudio\LaravelMailjetNotifier\MailjetSmsMessage;
use Illuminate\Notifications\Notification;use YieldStudio\LaravelMailjetNotifier\Channels\MailjetSmsChannel;use YieldStudio\LaravelMailjetNotifier\Messages\MailjetSmsMessage;

class ResetPassword extends Notification
{
Expand Down
24 changes: 15 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,26 @@
"email": "[email protected]",
"homepage": "https://yieldstudio.fr",
"role": "Developer"
},
{
"name": "Arthur Monney",
"email": "[email protected]",
"homepage": "https://yieldstudio.fr",
"role": "Developer"
}
],
"require": {
"php": "^8.0",
"illuminate/support": "^9|^10",
"illuminate/database": "^9|^10",
"mailjet/mailjet-apiv3-php": "^1.5"
"php": "^8.1|^8.2",
"illuminate/database": "^9|^10|^11",
"illuminate/support": "^9|^10|^11",
"mailjet/mailjet-apiv3-php": "^1.6"
},
"require-dev": {
"ciareis/bypass": "^1.0",
"friendsofphp/php-cs-fixer": "^3.8",
"orchestra/testbench": "7.*|8.*",
"pestphp/pest": "^1.21",
"phpunit/phpunit": "^9.1"
"laravel/pint": "^1.16",
"orchestra/testbench": "^7|^8|^9",
"pestphp/pest": "^2.34",
"phpunit/phpunit": "^9|^10"
},
"autoload": {
"psr-4": {
Expand All @@ -45,7 +51,7 @@
}
},
"scripts": {
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
"format": "vendor/bin/pint",
"test": "vendor/bin/pest",
"post-autoload-dump": [
"@php ./vendor/bin/testbench package:discover --ansi"
Expand Down
52 changes: 51 additions & 1 deletion config/mailjet.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,66 @@
<?php

declare(strict_types=1);

return [

/*
|--------------------------------------------------------------------------
| API Token
|--------------------------------------------------------------------------
|
| Your API Key & Secret from https://mailjet.com
|
*/

'key' => env('MAILJET_APIKEY', ''),
'secret' => env('MAILJET_APISECRET', ''),
'smsToken' => env('MAILJET_SMSTOKEN'),

/*
|--------------------------------------------------------------------------
| Email Sender
|--------------------------------------------------------------------------
|
| Email and Name used by Mailjet when sending email.
| This configuration is used when sending mail.
|
*/

'emailFrom' => [
'Email' => env('MAIL_FROM_ADDRESS'),
'Name' => env('MAIL_FROM_NAME'),
],

/*
|--------------------------------------------------------------------------
| SMS Sender
|--------------------------------------------------------------------------
|
| Defines the name that will be used as the "from" for all outgoing text messages
|
*/

'smsFrom' => env('MAILJET_SMS_SENDER'),
'smsToken' => env('MAILJET_SMSTOKEN'),

/*
|--------------------------------------------------------------------------
| Dry
|--------------------------------------------------------------------------
|
*/

'dry' => (bool) env('MAILJET_DRY', false),

/*
|--------------------------------------------------------------------------
| Options
|--------------------------------------------------------------------------
|
*/

'options' => [
'version' => 'v3.1',
],

];
10 changes: 10 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"preset": "laravel",
"rules": {
"concat_space": {
"spacing": "one"
},
"blank_line_before_statement": true,
"declare_strict_types": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@

declare(strict_types=1);

namespace YieldStudio\LaravelMailjetNotifier;
namespace YieldStudio\LaravelMailjetNotifier\Channels;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Notifications\Notification;
use YieldStudio\LaravelMailjetNotifier\Exceptions\MailjetException;
use YieldStudio\LaravelMailjetNotifier\MailjetService;

class MailjetEmailChannel
{
protected MailjetService $mailjetService;

/**
* Create a new mail channel instance.
*
* @param MailjetService $mailjetService
*
* @return void
*/
public function __construct(MailjetService $mailjetService)
{
$this->mailjetService = $mailjetService;
}
public function __construct(protected MailjetService $mailjetService) {}

/**
* @throws MailjetException
Expand Down
18 changes: 4 additions & 14 deletions src/MailjetSmsChannel.php → src/Channels/MailjetSmsChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@

declare(strict_types=1);

namespace YieldStudio\LaravelMailjetNotifier;
namespace YieldStudio\LaravelMailjetNotifier\Channels;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Notifications\Notification;
use YieldStudio\LaravelMailjetNotifier\Exceptions\MailjetException;
use YieldStudio\LaravelMailjetNotifier\MailjetService;

final class MailjetSmsChannel
{
protected MailjetService $mailjetService;

/**
* Create a new mail channel instance.
*
* @param MailjetService $mailjetService
*
* @return void
*/
public function __construct(MailjetService $mailjetService)
{
$this->mailjetService = $mailjetService;
}
public function __construct(protected MailjetService $mailjetService) {}

/**
* @throws MailjetException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace YieldStudio\LaravelMailjetNotifier;
namespace YieldStudio\LaravelMailjetNotifier\Exceptions;

use Exception;
use Mailjet\Response;
Expand Down
4 changes: 2 additions & 2 deletions src/MailjetNotifierServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function boot(): void
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config' => config_path(),
__DIR__ . '/../config' => config_path(),
], 'config');
}
}
Expand All @@ -21,7 +21,7 @@ public function register(): void
{
$this->mergeConfigFrom(__DIR__ . '/../config/mailjet.php', 'mailjet');

$this->app->bind(MailjetService::class, function () {
$this->app->bind(MailjetService::class, function (): MailjetService {
$key = config('mailjet.key', '');
$secret = config('mailjet.secret', '');
$smsToken = config('mailjet.smsToken');
Expand Down
Loading
Loading