1. Go to this page and download the library: Download kg-bot/hookbox 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/ */
namespace Hookbox\Contracts;
use Hookbox\SourceDefinition;
use Hookbox\VerificationResult;
use Illuminate\Http\Request;
interface Verifier
{
public function verify(Request $request, SourceDefinition $source): VerificationResult;
public function idempotencyKey(Request $request, SourceDefinition $source): ?string;
public function eventType(Request $request, SourceDefinition $source): ?string;
}
namespace Hookbox\Contracts;
use Hookbox\WebhookActionContext;
interface WebhookAction
{
public function handle(WebhookActionContext $context, \Closure $next): mixed;
}
use Hookbox\Facades\Hookbox;
Hookbox::handle('stripe')
->when(eventType: 'invoice.paid')
->through(\App\WebhookActions\MarkInvoicePaid::class);
namespace Hookbox;
final class ReplayService
{
public function replay(WebhookMessage|string $messageOrId, ReplayOptions $options): WebhookAttempt;
}