Docs · PHP

PHP logging and alerts, in 5 minutes

Your PHP app's errors with their stack trace, each request's thread and a phone alert when an order never finishes. One file, no dependencies; events go out once your user already has their response.

  1. 1

    Install

    // copy estiaje.php into your project (PHP 7.4+, with curl)

    It's a file with no dependencies: copy it from here.

  2. 2

    Your key

    Create your account and put the key in ESTIAJE_TOKEN. Or ask your AI “connect this repo to Estiaje” (the connector). Without the key nothing leaves over the network: you can instrument today.

  3. 3

    Your errors and each request's thread

    ● Tested in CI
    // app/Http/Middleware/HiloEstiaje.php
    class HiloEstiaje
    {
        public function handle(Request $request, Closure $next)
        {
            \Estiaje::empezarHilo($request->header('traceparent'));
            return $next($request);
        }
    }
    
    // bootstrap/app.php (Laravel 11+)
    ->withMiddleware(fn ($middleware) => $middleware->append(\App\Http\Middleware\HiloEstiaje::class))
    ->withExceptions(function (Exceptions $exceptions) {
        $exceptions->report(fn (Throwable $e) => \Estiaje::error($e));
    })
    // in your plugin or functions.php
    require_once __DIR__ . '/estiaje.php';
    Estiaje::capturarErrores();
    add_action('init', fn () => Estiaje::empezarHilo($_SERVER['HTTP_TRACEPARENT'] ?? null));
    require_once __DIR__ . '/estiaje.php';
    Estiaje::capturarErrores();   // uncaught errors
    Estiaje::empezarHilo($_SERVER['HTTP_TRACEPARENT'] ?? null);
  4. 4

    The process that must finish

    Estiaje::evento('order.paid', ['order_id' => $order->id, 'amount' => $order->total]);
    // … when it ships …
    Estiaje::evento('order.shipped', ['order_id' => $order->id], 'outcome');
  5. 5

    The alert

    In the dashboard, under Processes: “every order.paid expects its order.shipped, by order_id, within 30 minutes”. If it never comes, you get a phone, email or Slack alert, with the money at risk.

And if you want more
  • With php artisan config:cache, Laravel no longer loads .env: set ESTIAJE_TOKEN as a server variable.
  • When calling another service, pass the thread: Http::withHeaders(['traceparent' => \Estiaje::traceparent()]).
  • Errors you catch: Estiaje::error($e), with their stack.

Everything else is in the full docs.

Create account, 14 days of Pro No card required.