Laravel SDK
sentriq/laravel wraps sentriq/sentriq-php — never duplicating its HTTP implementation. Adds Laravel-specific registration, config, dependency injection, an optional facade, and a webhook-verification middleware.
Install
composer require sentriq/laravel
php artisan vendor:publish --tag=sentriq-configThe service provider auto-registers via Laravel package discovery — no manual config/app.php edit needed.
.env
SENTRIQ_SECRET_KEY=sec_test_...
SENTRIQ_API_URL=https://api.sentriq.testDependency injection (preferred)
use Sentriq\Sentriq;
class FraudReviewController
{
public function __construct(
private readonly Sentriq $sentriq,
) {}
public function show(string $eventId)
{
$event = $this->sentriq->events()->retrieve($eventId);
}
}Facade (optional)
use Sentriq\Laravel\Facades\Sentriq;
Sentriq::events()->submitOutcome($eventId, ['label' => 'legitimate']);Resolves the exact same container singleton as DI — pick whichever fits your codebase's existing style.
Webhook verification
use Sentriq\Laravel\Http\Middleware\VerifySentriqWebhook;
Route::post('/webhooks/sentriq', WebhookController::class)
->middleware(VerifySentriqWebhook::class);Reads config('sentriq.webhook_secret') by default. Verifies the raw request body against the Sentriq-Webhook-Timestamp/Sentriq-Webhook-Signature headers with constant-time comparison and rejects stale signatures — see Webhooks. Responds 401 on an invalid/stale signature, 400 if headers are missing, 500 if the secret isn't configured.
id is stable across retries of the same logical delivery — dedupe on it yourself if your handler needs exactly-once processing. That's an application concern, not something a generic verification middleware should own.Resources & errors
Identical to sentriq/sentriq-php — this package adds no Laravel-specific exception types.
Version compatibility
PHP ^8.2. Laravel ^11.0 || ^12.0 (tested against 12.66.0 via Orchestra Testbench 10.11.0).