diff --git a/CHANGELOG.md b/CHANGELOG.md index 95a6e6d..1eeedbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index e4c5e04..4cbd93d 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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, @@ -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 diff --git a/composer.json b/composer.json index 2da92a6..b5e6988 100644 --- a/composer.json +++ b/composer.json @@ -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": { @@ -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", @@ -50,7 +50,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "9.x-dev" }, "laravel": { "providers": [ diff --git a/src/ProcessMailgunWebhookJob.php b/src/ProcessMailgunWebhookJob.php index 562e5aa..17dbb49 100644 --- a/src/ProcessMailgunWebhookJob.php +++ b/src/ProcessMailgunWebhookJob.php @@ -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 { diff --git a/tests/MailgunWebhookCallTest.php b/tests/MailgunWebhookCallTest.php index 3cfcfd9..978c89b 100644 --- a/tests/MailgunWebhookCallTest.php +++ b/tests/MailgunWebhookCallTest.php @@ -30,6 +30,7 @@ public function setUp(): void 'key' => 'value', ], ], + 'url' => '/webhooks/mailgun.com', ]); $this->processMailgunWebhookJob = new ProcessMailgunWebhookJob($this->webhookCall); diff --git a/tests/TestCase.php b/tests/TestCase.php index ceda080..cb425b9 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,7 +3,6 @@ namespace Tests; use BinaryCats\MailgunWebhooks\MailgunWebhooksServiceProvider; -use CreateWebhookCallsTable; use Exception; use Illuminate\Contracts\Debug\ExceptionHandler; use Illuminate\Foundation\Exceptions\Handler; @@ -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']); @@ -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(); } /**