apirelio/nette

Fail-safe Nette SDK for Apirelio customer integration analytics.

Maintainers

Package info

github.com/pryznar/apirelio-nette

pkg:composer/apirelio/nette

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.2.1 2026-07-31 12:37 UTC

This package is auto-updated.

Last update: 2026-08-13 15:08:04 UTC


README

Packagist Live demo

See the customer behind every API request

Apirelio live demo dashboard

Follow a release regression from the failing endpoint to the exact customer accounts it affects in the public, read-only workspace.

Explore the live demo →

Try it in 30 seconds

composer require apirelio/nette
export APIRELIO_API_KEY=apr_live_your_project_key

Copy the minimal setup below or run the quickstart example. Delivery is fail-safe and no request or response payloads are captured.

Documentation · Packagist · Apirelio

Connect Nette API errors, latency and releases to the affected customers without capturing request or response payloads.

Fail-safe customer integration analytics for Nette applications. The package uses the shared apirelio/php-core event contract, sanitization, retry and file buffer.

Requirements

  • PHP 8.2+
  • Nette Application 3.2 or 3.3
  • ext-curl

Installation

composer require apirelio/nette:^0.2

Register the native DI extension:

extensions:
    apirelio: Apirelio\Nette\DI\ApirelioExtension

apirelio:
    apiKey: %env.APIRELIO_API_KEY%
    endpoint: https://apirelio.com
    service: billing-api
    environment: production
    release: 2026.07.29.1
    paths:
        - /api/*
    metadataKeys:
        - region

The extension automatically records matched Nette application requests through onRequest, onResponse and onError. Delivery failures are swallowed and optionally logged, so analytics cannot change the customer response.

The default fileBuffer transport persists events before sending them. Use a writable application temp directory:

apirelio:
    transport: fileBuffer
    bufferPath: %tempDir%/apirelio/events.ndjson
    batchSize: 500
    flushIntervalSeconds: 10

For direct synchronous delivery:

apirelio:
    transport: sync

Request context

Inject Apirelio\Nette\ApirelioManager into a presenter or service:

use Apirelio\Nette\ApirelioManager;

final class InvoiceService
{
    public function __construct(private ApirelioManager $apirelio) {}

    public function create(): void
    {
        $this->apirelio->addMetadata(['region' => 'eu-central']);
        $this->apirelio->setErrorCode('VALIDATION_FAILED');
    }
}

Only keys listed in metadataKeys are retained. Secrets, request bodies, query parameters, cookies and authorization headers are never collected.

Manual business events

$apirelio->track(
    event: 'invoice.created',
    integration: 'fakturoid',
    metadata: ['region' => 'eu-central'],
);

Customer and application resolvers

Implement the resolver contracts:

use Nette\Application\Request;
use Apirelio\Nette\Contracts\CustomerResolver;
use Apirelio\Nette\Data\ApirelioCustomer;

final class CurrentCustomerResolver implements CustomerResolver
{
    public function resolve(Request $request): ?ApirelioCustomer
    {
        return new ApirelioCustomer('customer_42', 'Acme Europe', 'growth');
    }
}

Register the services and reference their service names:

services:
    app.customerResolver: App\Analytics\CurrentCustomerResolver
    app.applicationResolver: App\Analytics\CurrentApplicationResolver

apirelio:
    customerResolver: app.customerResolver
    applicationResolver: app.applicationResolver

Development

composer test
composer phpstan