1. Go to this page and download the library: Download snb4crazy/notifyhub-laravel 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/ */
snb4crazy / notifyhub-laravel example snippets
use NotifyHub\LaravelClient\Facades\NotifyHub;
use NotifyHub\LaravelClient\Data\EventPayload;
NotifyHub::send(new EventPayload(
title: 'Payment declined',
message: 'Stripe returned error code card_declined',
severity: 'error',
eventType: 'payment.failed',
application: config('app.name'),
environment: app()->environment(),
context: ['order_id' => $order->id],
));
use NotifyHub\LaravelClient\Contracts\NotifyHubClientInterface;
class MyService
{
public function __construct(private NotifyHubClientInterface $notifyHub) {}
public function doWork(): void
{
try {
// ...
} catch (\Throwable $e) {
$this->notifyHub->sendException($e);
}
}
}