PHP code example of oanhnn / laravel-webhook-notification
1. Go to this page and download the library: Download oanhnn/laravel-webhook-notification library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
oanhnn / laravel-webhook-notification example snippets
class User extends Authenticatable implements WebhookNotifiable
{
use Notifiable;
/**
* @return string
*/
public function getSigningKey(): string
{
return $this->api_key;
}
/**
* @return string
*/
public function getWebhookUrl(): string
{
return $this->webhook_url;
}
}
class ProjectCreated extends Notification
{
/**
* @return array
*/
public function via($notifiable)
{
return [WebhookChannel::class];
}
/**
* @return array|WebhookMessage
*/
public function toWebhook($notifiable)
{
return WebhookMessage::create()
->data([
'payload' => [
'foo' => 'bar'
]
])
->userAgent("Custom-User-Agent")
->header('X-Custom', 'Custom-Header');
}
}