laravel-inbound maintained by relaylayerio
relaylayerio/laravel-inbound
Report Laravel application events to RelayLayer’s inbound API (POST /api/v1/events) with almost no app-specific code.
Works with Laravel 10–13. Use an inbound source token (rl_src_…), not a notification API key (rl_live_ / rl_test_).
This package covers the app layer (exceptions, failed jobs, scheduler). CSF/LFD still uses the server helpers in docs/examples/.
Install
From Packagist (when published):
composer require relaylayerio/laravel-inbound
In-house path install (RightwayParking, Cedar & Steel, and other apps next to this repo):
{
"repositories": [
{
"type": "path",
"url": "../in_house/relaylayer/packages/laravel-inbound",
"options": { "symlink": true }
}
],
"require": {
"relaylayerio/laravel-inbound": "@dev"
}
}
Then:
composer require relaylayerio/laravel-inbound:@dev
php artisan vendor:publish --tag=relaylayer-inbound-config
RelayLayer dashboard
- Open the project → Server events.
- Create a source of type Laravel.
- Copy the one-time
rl_src_…token. - Add emails on Recipients if people should be notified.
Minimal .env
RELAYLAYER_INBOUND_URL=https://api.relaylayer.io/api/v1/events
RELAYLAYER_INBOUND_TOKEN=rl_src_...
RELAYLAYER_HOSTNAME=rightwayparking.com
RELAYLAYER_INBOUND_ENABLED=true
RELAYLAYER_URL / RELAYLAYER_TOKEN are also accepted so you can reuse a CSF-style env file.
No bootstrap/app.php changes are required. The service provider auto-discovers.
Keep a queue worker running (php artisan queue:work). Outbound POSTs are queued so checkout and other requests are not blocked. Keep the Laravel scheduler running so app.scheduler_ok heartbeats fire.
What is reported automatically
| Hook | Event | Default severity | Routing on RelayLayer |
|---|---|---|---|
| Unhandled exceptions | app.exception |
error |
Immediate |
| Failed queue jobs | app.queue_failed |
error |
Immediate |
| Scheduler heartbeat | app.scheduler_ok |
info |
Hourly digest |
php artisan relaylayer:inbound-heartbeat --stale |
app.scheduler_stale |
warning |
Immediate |
Validation errors, 401/403/404/419/422/429, and this package’s own delivery job are not reported.
Custom events
use RelayLayer\LaravelInbound\Facades\RelayLayer;
RelayLayer::event('app.payment_failed', 'error', 'Stripe charge declined', [
'order_id' => $order->id,
'gateway' => 'stripe',
]);
// or
relaylayer('app.payment_failed', 'error', 'Stripe charge declined', [
'order_id' => $order->id,
]);
Event names must look like app.something (source.detail). Cookies, Authorization, tokens, and card-ish keys are redacted before the payload is queued.
Config toggles
| Env | Default | Purpose |
|---|---|---|
RELAYLAYER_INBOUND_ENABLED |
true |
Master switch |
RELAYLAYER_INBOUND_REPORT_EXCEPTIONS |
true |
Exception hook |
RELAYLAYER_INBOUND_REPORT_FAILED_JOBS |
true |
Queue::failing |
RELAYLAYER_INBOUND_HEARTBEAT |
true |
Scheduled pulse |
RELAYLAYER_INBOUND_HEARTBEAT_MINUTES |
10 |
Pulse interval |
RELAYLAYER_INBOUND_QUEUE |
default | Queue name for the outbound POST |
Failed deliveries are retried, then appended to storage/logs/relaylayer-inbound-spool.jsonl.
Tests
cd packages/laravel-inbound
composer install
vendor/bin/pest