Skip to content

Commit

Permalink
Merge pull request #20 from binary-cats/patch-1
Browse files Browse the repository at this point in the history
v9.1 Drop PHP 7 and test-ready for L9
  • Loading branch information
cyrillkalita authored Jan 26, 2022
2 parents 9cb914a + 0afaf1e commit 4e0f18f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to `laravel-mailgun-webhooks` will be documented in this file

## 9.1.0 - 2022-01-26

- Drop support for PHP 7
- Upgrade spatie/laravel-webhook-client to version 2.0
- Test Laravel 9 integration

## 9.0.0 - 2022-01-20

- Add support for Laravel 9

## 1.1.0 - 2020-03-04

- add support for Laravel 7
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ This package will not handle what should be done after the webhook request has b

Before using this package we highly recommend reading [the entire documentation on webhooks over at Mailgun](https://documentation.mailgun.com/en/latest/api-webhooks.html).

This package is an almost line-to-line adapted copy of absolutely amazing [spatie/laravel-stripe-webhooks](https://github.com/spatie/laravel-stripe-webhooks)
This package is an adapted copy of absolutely amazing [spatie/laravel-stripe-webhooks](https://github.com/spatie/laravel-stripe-webhooks)

## Upgrade

If you are upgrading from previous version, please note that spatie/laravel-webhook-client has been upgraded to ^3.0 - which adds an extra field into the webhooks table. Read [upgrading instructions](https://github.com/spatie/laravel-webhook-client/blob/main/UPGRADING.md) for more details.

## Installation

Expand Down Expand Up @@ -47,6 +51,9 @@ return [
*
* You can find a list of Mailgun webhook types here:
* https://documentation.mailgun.com/en/latest/api-webhooks.html#webhooks.
*
* The package will automatically convert the keys to lowercase, but you should
* be congnisant of the fact that array keys are case sensitive
*/
'jobs' => [
// 'delivered' => \BinaryCats\MailgunWebhooks\Jobs\HandleDelivered::class,
Expand Down Expand Up @@ -112,6 +119,8 @@ If something goes wrong during the webhook request the thrown exception will be

There are two ways this package enables you to handle webhook requests: you can opt to queue a job or listen to the events the package will fire.

**Due to the apparent differences between MailGun sandbox and production environment event casing, the package will ALWAYS cast mailgun events to lowercase - so your configured keys must be lowercase, too**

**The package does not handle legacy webhooks, as they have a different schema.** Let me know if this is something that is needed.

### Handling webhook requests using jobs
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
}
],
"require": {
"php": "^7.4|^8.0",
"php": "^8.0",
"illuminate/support": "^8.0|^9.0",
"spatie/laravel-webhook-client": "^2.0"
"spatie/laravel-webhook-client": "^3.0"
},
"require-dev": {
"orchestra/testbench": "^6.0",
"phpunit/phpunit": "^9.3.3"
"orchestra/testbench": "^6.0|^7.0",
"phpunit/phpunit": "^9.4"
},
"autoload": {
"psr-4": {
Expand All @@ -37,7 +37,7 @@
}
},
"suggest": {
"binary-cats/laravel-mail-helpers": "^6.0"
"binary-cats/laravel-lob-webhooks": "^9.0"
},
"scripts": {
"analyze": "./vendor/bin/phpstan analyse src --memory-limit=2G",
Expand All @@ -50,7 +50,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
"dev-master": "9.x-dev"
},
"laravel": {
"providers": [
Expand Down
2 changes: 1 addition & 1 deletion src/ProcessMailgunWebhookJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use BinaryCats\MailgunWebhooks\Exceptions\WebhookFailed;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Spatie\WebhookClient\ProcessWebhookJob;
use Spatie\WebhookClient\Jobs\ProcessWebhookJob;

class ProcessMailgunWebhookJob extends ProcessWebhookJob
{
Expand Down
1 change: 1 addition & 0 deletions tests/MailgunWebhookCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function setUp(): void
'key' => 'value',
],
],
'url' => '/webhooks/mailgun.com',
]);

$this->processMailgunWebhookJob = new ProcessMailgunWebhookJob($this->webhookCall);
Expand Down
13 changes: 6 additions & 7 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Tests;

use BinaryCats\MailgunWebhooks\MailgunWebhooksServiceProvider;
use CreateWebhookCallsTable;
use Exception;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Foundation\Exceptions\Handler;
Expand All @@ -28,11 +27,11 @@ public function setUp(): void
*/
protected function getEnvironmentSetUp($app)
{
$app['config']->set('database.default', 'sqlite');
$app['config']->set('database.connections.sqlite', [
'driver' => 'sqlite',
config()->set('database.default', 'sqlite');
config()->set('database.connections.sqlite', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
'prefix' => '',
]);

config(['mailgun-webhooks.signing_secret' => 'test_signing_secret']);
Expand All @@ -43,9 +42,9 @@ protected function getEnvironmentSetUp($app)
*/
protected function setUpDatabase()
{
include_once __DIR__.'/../vendor/spatie/laravel-webhook-client/database/migrations/create_webhook_calls_table.php.stub';
$migration = include __DIR__.'/../vendor/spatie/laravel-webhook-client/database/migrations/create_webhook_calls_table.php.stub';

(new CreateWebhookCallsTable())->up();
$migration->up();
}

/**
Expand Down

0 comments on commit 4e0f18f

Please sign in to comment.