Skip to content

Commit 9096e4e

Browse files
committed
Fix Readme documentation
1 parent ed236ae commit 9096e4e

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ return [
4747

4848
/*
4949
* The classname of the model to be used. The class should equal or extend
50-
* BinaryCats\MailgunWebhooks\WebhookCall which is a child of Spatie\WebhookClient\Models\WebhookCall
50+
* Spatie\WebhookClient\Models\WebhookCall
5151
*/
52-
'model' => \BinaryCats\MailgunWebhooks\WebhookCall::class,
52+
'model' => \Spatie\WebhookClient\Models\WebhookCall::class,
5353

5454
/*
5555
* The classname of the model to be used. The class should equal or extend
@@ -77,17 +77,18 @@ php artisan migrate
7777
### Routing
7878
Finally, take care of the routing: At [the Mailgun dashboard](https://app.mailgun.com/app/sending/domains) you must configure at what url Mailgun webhooks should hit your app. In the routes file of your app you must pass that route to `Route::mailgunWebhooks()`:
7979

80-
I like to group functionality by domain, so would suggest `webwooks\mailgun`
80+
I like to group functionality by domain, so I would suggest `webwooks/mailgun` (especially if you plan to have more webhooks), but it is up to you.
8181

8282
```php
83-
Route::mailgunWebhooks('webwooks\mailgun');
83+
# routes\web.php
84+
Route::mailgunWebhooks('webwooks/mailgun');
8485
```
8586

8687
Behind the scenes this will register a `POST` route to a controller provided by this package. Because Mailgun has no way of getting a csrf-token, you must add that route to the `except` array of the `VerifyCsrfToken` middleware:
8788

8889
```php
8990
protected $except = [
90-
'webwooks\mailgun',
91+
'webwooks/mailgun',
9192
];
9293
```
9394

@@ -118,13 +119,13 @@ use Illuminate\Bus\Queueable;
118119
use Illuminate\Queue\SerializesModels;
119120
use Illuminate\Queue\InteractsWithQueue;
120121
use Illuminate\Contracts\Queue\ShouldQueue;
121-
use BinaryCats\MailgunWebhooks\WebhookCall;
122+
use Spatie\WebhookClient\Models\WebhookCall;
122123

123-
class HandleDeliveredSource implements ShouldQueue
124+
class HandleDelivered implements ShouldQueue
124125
{
125126
use InteractsWithQueue, Queueable, SerializesModels;
126127

127-
/** @var \BinaryCats\MailgunWebhooks\WebhookCall */
128+
/** @var \Spatie\WebhookClient\Models\WebhookCall */
128129
public $webhookCall;
129130

130131
public function __construct(WebhookCall $webhookCall)
@@ -206,7 +207,7 @@ The above example is only one way to handle events in Laravel. To learn the othe
206207
All incoming webhook requests are written to the database. This is incredibly valuable when something goes wrong while handling a webhook call. You can easily retry processing the webhook call, after you've investigated and fixed the cause of failure, like this:
207208

208209
```php
209-
use BinaryCats\MailgunWebhooks\WebhookCall;
210+
use Spatie\WebhookClient\Models\WebhookCall;
210211
use BinaryCats\MailgunWebhooks\ProcessMailgunWebhookJob;
211212

212213
dispatch(new ProcessMailgunWebhookJob(WebhookCall::find($id)));
@@ -240,24 +241,24 @@ When needed might want to the package to handle multiple endpoints and secrets.
240241
If you are using the `Route::mailgunWebhooks` macro, you can append the `configKey` as follows:
241242

242243
```php
243-
Route::mailgunWebhooks('webhook-url/{configKey}');
244+
Route::mailgunWebhooks('webwooks/mailgun/{configKey}');
244245
```
245246

246247
Alternatively, if you are manually defining the route, you can add `configKey` like so:
247248

248249
```php
249-
Route::post('webhook-url/{configKey}', 'BinaryCats\MailgunWebhooks\MailgunWebhooksController');
250+
Route::post('webwooks/mailgun/{configKey}', 'BinaryCats\MailgunWebhooks\MailgunWebhooksController');
250251
```
251252

252-
If this route parameter is present the verify middleware will look for the secret using a different config key, by appending the given the parameter value to the default config key. E.g. If Mailgun posts to `webhook-url/my-named-secret` you'd add a new config named `signing_secret_my-named-secret`.
253+
If this route parameter is present the verify middleware will look for the secret using a different config key, by appending the given the parameter value to the default config key. E.g. If Mailgun posts to `webwooks/mailgun/my-named-secret` you'd add a new config named `signing_secret_my-named-secret`.
253254

254255
Example config might look like:
255256

256257
```php
257-
// secret for when Mailgun posts to webhook-url/account
258+
// secret for when Mailgun posts to webwooks/mailgun/account
258259
'signing_secret_account' => 'whsec_abc',
259-
// secret for when Mailgun posts to webhook-url/connect
260-
'signing_secret_connect' => 'whsec_123',
260+
// secret for when Mailgun posts to webwooks/mailgun/my-named-secret
261+
'signing_secret_my-named-secret' => 'whsec_123',
261262
```
262263

263264
### About Mailgun

0 commit comments

Comments
 (0)