PHPackages                             apirelio/laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. apirelio/laravel

ActiveLibrary

apirelio/laravel
================

Fail-safe Laravel SDK for Apirelio customer integration analytics.

v0.2.0(today)00MITPHPPHP ^8.2CI passing

Since Jul 29Pushed todayCompare

[ Source](https://github.com/pryznar/apirelio-laravel)[ Packagist](https://packagist.org/packages/apirelio/laravel)[ RSS](/packages/apirelio-laravel/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (8)Versions (5)Used By (0)

Apirelio Laravel SDK
====================

[](#apirelio-laravel-sdk)

Fail-safe request analytics for Laravel APIs. The SDK records normalized route metrics and customer integration context without capturing request or response bodies, credentials, cookies, query strings, IP addresses, or personal data. The shared event contract, privacy rules and delivery primitives come from `apirelio/php-core`, installed automatically by Composer.

Requirements
------------

[](#requirements)

- PHP 8.2, 8.3 or 8.4
- Laravel 11 or 12

Installation
------------

[](#installation)

```
composer require apirelio/laravel:^0.2
php artisan vendor:publish --tag=apirelio-config
```

Configure the project key shown once in the Apirelio dashboard:

```
APIRELIO_ENABLED=true
APIRELIO_ENDPOINT=https://api.apirelio.com
APIRELIO_API_KEY=apr_live_xxxxxxxxx
APIRELIO_SERVICE=billing-api
APIRELIO_ENVIRONMENT=production
APIRELIO_RELEASE=2026.07.29.1
APIRELIO_TRANSPORT=queue
```

The production `queue` transport keeps network activity outside customer requests. Make sure both the Laravel queue worker and scheduler are running:

```
php artisan queue:work
php artisan schedule:work
```

Middleware
----------

[](#middleware)

Attach the middleware alias to API routes:

```
Route::middleware(['auth:sanctum', 'apirelio'])->group(function (): void {
    Route::post('/invoices/{invoice}/send', SendInvoiceController::class);
});
```

Or use the class directly:

```
use Apirelio\Laravel\Middleware\TrackApiRequest;

Route::middleware(TrackApiRequest::class)->group(/* ... */);
```

Only paths allowed by `apirelio.paths` are recorded. Laravel route templates are used instead of concrete URLs, so `/invoices/123` becomes `/invoices/{invoice}` and query strings are never sent.

Customer and application identity
---------------------------------

[](#customer-and-application-identity)

Register resolvers in an application service provider:

```
use Illuminate\Http\Request;
use Apirelio\Laravel\Data\ApirelioApplication;
use Apirelio\Laravel\Data\ApirelioCustomer;
use Apirelio\Laravel\Facades\Apirelio;

Apirelio::resolveCustomerUsing(
    static function (Request $request): ?ApirelioCustomer {
        $client = $request->user();

        return $client === null
            ? null
            : new ApirelioCustomer(
                id: (string) $client->company_id,
                name: $client->company->name,
                plan: $client->company->plan,
            );
    },
);

Apirelio::resolveApplicationUsing(
    static fn (Request $request): ?ApirelioApplication =>
        $request->user()?->api_client_id === null
            ? null
            : new ApirelioApplication(
                id: (string) $request->user()->api_client_id,
                name: 'ERP connector',
            ),
);
```

Error codes and metadata
------------------------

[](#error-codes-and-metadata)

JSON error codes are read from `error.code` by default. Override a code during the current request when needed:

```
Apirelio::setErrorCode('INVALID_CURRENCY');
```

Custom metadata is allow-listed in `config/apirelio.php`:

```
'metadata_keys' => ['integration_type', 'region'],
```

```
Apirelio::addMetadata([
    'integration_type' => 'accounting',
    'region' => 'eu-central',
]);
```

Values must be scalar. Unlisted keys are discarded.

Transports and batching
-----------------------

[](#transports-and-batching)

- `queue` (default): enqueue locally, batch in a locked file buffer, and flush from the worker/scheduler.
- `sync`: send immediately; intended for local development and diagnostics.
- `file-buffer`: append directly to the local buffer and flush by size or from the scheduler.

```
APIRELIO_BATCH_SIZE=500
APIRELIO_FLUSH_INTERVAL_SECONDS=10
APIRELIO_TIMEOUT_SECONDS=2
APIRELIO_CONNECT_TIMEOUT_SECONDS=0.5
```

Transport and resolver failures are caught by the SDK. Analytics may lose an event, but it never changes the customer API response or masks its exception.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

0d ago

PHP version history (2 changes)v0.1.0PHP ^8.4

v0.1.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/461b0a594590cb170c4544f10538e6fef5a98320c4f584188fc1a34c10143545?d=identicon)[pryznar](/maintainers/pryznar)

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/apirelio-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/apirelio-laravel/health.svg)](https://phpackages.com/packages/apirelio-laravel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M348](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M139](/packages/laravel-pulse)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77922.3M192](/packages/laravel-mcp)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M134](/packages/roots-acorn)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k96.5k1](/packages/mike-bronner-laravel-model-caching)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
