Laravel
A Laravel wrapper around the PHP SDK. It adds a service provider, publishable config, and typed webhook events so you don't have to wire the SDK into your application by hand.
- Package:
ecourier/ecourier-laravel - Repository: github.com/utecca/ecourier-laravel
- Requirements: PHP 8.4+, Laravel 12 or 13
Installation
composer require ecourier/ecourier-laravel
php artisan vendor:publish --tag=ecourier-config
Configuration
Set your API key in .env:
ECOURIER_API_KEY=pk_test_your_key
Usage
The SDK's EcourierConnector is bound in the container, so you can resolve it wherever you need it:
use Ecourier\EcourierConnector;
$document = app(EcourierConnector::class)->documents()->find('doc_01xyz');
All resources and methods — companies, documents, participants, lookup — work exactly as in the PHP SDK.
Webhooks
The package registers an incoming webhook route at /webhooks/ecourier by default and verifies, stores, and dispatches events using spatie/laravel-webhook-client. See API & Webhooks for background on eCourier's webhook events.
ECOURIER_WEBHOOK_SECRET=your_webhook_secret
ECOURIER_WEBHOOK_MODEL="App\Models\WebhookCall"
Listen for parsed webhook events:
use Ecourier\Laravel\Events\EcourierWebhookReceived;
Event::listen(EcourierWebhookReceived::class, function (EcourierWebhookReceived $event) {
$event->webhook; // Ecourier\Data\Webhook\DocumentWebhook
$event->webhookCall; // Spatie webhook call model
});
Learn more
For full configuration options and advanced usage, see the package README on GitHub.