You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want to customize the signing process you can create your own custom signer. A signer is any class that implements `Spatie\WebhookServer\Signer`.
120
121
122
+
This is what that interface looks like.
121
123
122
-
### Testing
124
+
```php
125
+
namespace Spatie\WebhookServer\Signer;
126
+
127
+
interface Signer
128
+
{
129
+
public function signatureHeaderName(): string;
130
+
131
+
public function calculateSignature(array $payload, string $secret): string;
132
+
}
133
+
```
134
+
135
+
After creating your signer you can specify it's class name in the `signer` key of the `webhook-server` config file. Your signer will than be used by default in all webhook calls.
136
+
137
+
You can also specify a signer for a specific webhook call
138
+
139
+
```php
140
+
Webhook::create()
141
+
->signUsing(YourCustomSigner::class)
142
+
...
143
+
->call();
144
+
```
145
+
146
+
### Customizing the http verb
147
+
148
+
By default all webhooks will use the `post` method. You can customize that by specify the http verb you want in the `http_verb` key of the `webhook-server` config file.
149
+
150
+
You can also override the default for a specific call by use the `useHttpVerb` method.
151
+
152
+
```php
153
+
Webhook::create()
154
+
->useHttpVerb('get')
155
+
...
156
+
->call();
157
+
```
158
+
159
+
### Adding extra headers
160
+
161
+
You can extra headers by adding the to the `headers` key in the `webhook-server` config file. If you want to add extra headers for a specific webhook you can use the `withHeaders` call.
162
+
163
+
```php
164
+
Webhook::create()
165
+
->withHeaders([
166
+
'Another Header' => 'Value of Another Header'
167
+
])
168
+
...
169
+
->call();
170
+
```
171
+
172
+
### Verifying the ssl certificate of the receiving app
173
+
174
+
When using an url that starts with `https://` the package will verify if the ssl certificate of the receiving party is valid. If it is not, we will consider the webhook call failed. We don't recommend this but you can turn off this verification by setting the `verify_ssl` key in the `webhook-server` config file to `false`.
175
+
176
+
You can also disable the verification per webhook call with the `doNotVerifySsl` method.
177
+
178
+
```php
179
+
Webhook::create()
180
+
->doNotVerifySsl()
181
+
...
182
+
->call();
183
+
```
184
+
185
+
## Testing
123
186
124
187
```bash
125
188
composer test
126
189
```
127
190
128
-
###Changelog
191
+
## Changelog
129
192
130
193
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
0 commit comments