Quickstart
Install the native extension.
Install the package and register its compiler extension in your NEON configuration. Composer installs the shared PHP Core automatically.
composer require apirelio/nette:^0.2# app/config/common.neon
extensions:
apirelio: Apirelio\Nette\DI\ApirelioExtension
apirelio:
apiKey: %env.APIRELIO_API_KEY%
endpoint: https://api.apirelio.com
service: billing-api
environment: production
release: 2026.07.30.1
paths:
- /api/*
metadataKeys:
- regionAutomatic tracking
No presenter instrumentation.
The extension hooks into onRequest, onResponse and onError. It captures matching application requests, normalizes numeric, UUID and ULID path segments, and clears request context after delivery.
onRequest
Starts timing and associates the Nette application request.
onResponse
Emits the normalized successful or handled response event.
onError
Records an unhandled exception without replacing or masking it.
Customer context
Connect your authentication model.
Implement the customer and application resolver contracts, register them as services and reference the service names from the Apirelio section.
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',
);
}
}services:
app.customerResolver: App\Analytics\CurrentCustomerResolver
app.applicationResolver: App\Analytics\CurrentApplicationResolver
apirelio:
customerResolver: app.customerResolver
applicationResolver: app.applicationResolverDiagnostics
Enrich the current request.
Inject ApirelioManager into a presenter or service. Only metadata keys declared in metadataKeys are retained.
final class InvoiceService
{
public function __construct(
private ApirelioManager $apirelio,
) {}
public function create(): void
{
$this->apirelio->addMetadata(['region' => 'eu-central']);
$this->apirelio->setErrorCode('VALIDATION_FAILED');
}
}Manual events
Track an integration milestone.
Use a low-cardinality business event when a meaningful integration action is not represented by one HTTP endpoint.
$apirelio->track(
event: 'invoice.created',
integration: 'fakturoid',
metadata: ['region' => 'eu-central'],
);Reliability
Buffer by default.
The default fileBuffer transport persists events in a locked NDJSON file and flushes them by size or interval. Use a writable application temp directory.
apirelio:
transport: fileBuffer
bufferPath: %tempDir%/apirelio/events.ndjson
batchSize: 500
flushIntervalSeconds: 10Switch to transport: sync when verifying credentials and ingestion during development.