Skip to content

Commit 4e0f18f

Browse files
authored
Merge pull request #20 from binary-cats/patch-1
v9.1 Drop PHP 7 and test-ready for L9
2 parents 9cb914a + 0afaf1e commit 4e0f18f

6 files changed

+34
-15
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

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

5+
## 9.1.0 - 2022-01-26
6+
7+
- Drop support for PHP 7
8+
- Upgrade spatie/laravel-webhook-client to version 2.0
9+
- Test Laravel 9 integration
10+
11+
## 9.0.0 - 2022-01-20
12+
13+
- Add support for Laravel 9
14+
515
## 1.1.0 - 2020-03-04
616

717
- add support for Laravel 7

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ This package will not handle what should be done after the webhook request has b
1313

1414
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).
1515

16-
This package is an almost line-to-line adapted copy of absolutely amazing [spatie/laravel-stripe-webhooks](https://github.com/spatie/laravel-stripe-webhooks)
16+
This package is an adapted copy of absolutely amazing [spatie/laravel-stripe-webhooks](https://github.com/spatie/laravel-stripe-webhooks)
17+
18+
## Upgrade
19+
20+
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.
1721

1822
## Installation
1923

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

113120
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.
114121

122+
**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**
123+
115124
**The package does not handle legacy webhooks, as they have a different schema.** Let me know if this is something that is needed.
116125

117126
### Handling webhook requests using jobs

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
}
1919
],
2020
"require": {
21-
"php": "^7.4|^8.0",
21+
"php": "^8.0",
2222
"illuminate/support": "^8.0|^9.0",
23-
"spatie/laravel-webhook-client": "^2.0"
23+
"spatie/laravel-webhook-client": "^3.0"
2424
},
2525
"require-dev": {
26-
"orchestra/testbench": "^6.0",
27-
"phpunit/phpunit": "^9.3.3"
26+
"orchestra/testbench": "^6.0|^7.0",
27+
"phpunit/phpunit": "^9.4"
2828
},
2929
"autoload": {
3030
"psr-4": {
@@ -37,7 +37,7 @@
3737
}
3838
},
3939
"suggest": {
40-
"binary-cats/laravel-mail-helpers": "^6.0"
40+
"binary-cats/laravel-lob-webhooks": "^9.0"
4141
},
4242
"scripts": {
4343
"analyze": "./vendor/bin/phpstan analyse src --memory-limit=2G",
@@ -50,7 +50,7 @@
5050
},
5151
"extra": {
5252
"branch-alias": {
53-
"dev-master": "2.x-dev"
53+
"dev-master": "9.x-dev"
5454
},
5555
"laravel": {
5656
"providers": [

src/ProcessMailgunWebhookJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use BinaryCats\MailgunWebhooks\Exceptions\WebhookFailed;
66
use Illuminate\Support\Arr;
77
use Illuminate\Support\Str;
8-
use Spatie\WebhookClient\ProcessWebhookJob;
8+
use Spatie\WebhookClient\Jobs\ProcessWebhookJob;
99

1010
class ProcessMailgunWebhookJob extends ProcessWebhookJob
1111
{

tests/MailgunWebhookCallTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function setUp(): void
3030
'key' => 'value',
3131
],
3232
],
33+
'url' => '/webhooks/mailgun.com',
3334
]);
3435

3536
$this->processMailgunWebhookJob = new ProcessMailgunWebhookJob($this->webhookCall);

tests/TestCase.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Tests;
44

55
use BinaryCats\MailgunWebhooks\MailgunWebhooksServiceProvider;
6-
use CreateWebhookCallsTable;
76
use Exception;
87
use Illuminate\Contracts\Debug\ExceptionHandler;
98
use Illuminate\Foundation\Exceptions\Handler;
@@ -28,11 +27,11 @@ public function setUp(): void
2827
*/
2928
protected function getEnvironmentSetUp($app)
3029
{
31-
$app['config']->set('database.default', 'sqlite');
32-
$app['config']->set('database.connections.sqlite', [
33-
'driver' => 'sqlite',
30+
config()->set('database.default', 'sqlite');
31+
config()->set('database.connections.sqlite', [
32+
'driver' => 'sqlite',
3433
'database' => ':memory:',
35-
'prefix' => '',
34+
'prefix' => '',
3635
]);
3736

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

48-
(new CreateWebhookCallsTable())->up();
47+
$migration->up();
4948
}
5049

5150
/**

0 commit comments

Comments
 (0)