Laravel

Altix ErrorTrack utilise le protocole Sentry : vous pouvez donc vous servir du SDK officiel sentry/sentry-laravel. Les extraits ci-dessous utilisent un DSN d'exemple ; la page de configuration de votre projet les affiche avec votre véritable DSN.

  1. Installer le SDK

    Ajoutez sentry/sentry-laravel, le SDK Sentry officiel. Il fonctionne sans aucune modification avec Altix ErrorTrack.

    bash

    composer require sentry/sentry-laravel
  2. Le configurer

    Initialisez le SDK le plus tôt possible dans votre application, à l'aide de votre DSN.

    bootstrap/app.php

    use Sentry\Laravel\Integration;
    
    return Application::configure(basePath: dirname(__DIR__))
        // …
        ->withExceptions(function (Exceptions $exceptions) {
            Integration::handles($exceptions);
        })
        ->create();

    bash

    php artisan sentry:publish --dsn=https://<public-key>@errortrack.altixcode.com/<project-id>
    # Writes SENTRY_LARAVEL_DSN to .env. Then set:
    # SENTRY_RELEASE=my-app@1.0.0
    # SENTRY_TRACES_SAMPLE_RATE=1.0
  3. Vérifier

    Déclenchez volontairement une erreur. Elle apparaîtra dans votre flux de problèmes en quelques secondes.

    php

    // routes/web.php
    Route::get('/debug-sentry', function () {
        throw new Exception('My first ErrorTrack error');
    });

Créez un projet et sa page de configuration préremplira votre véritable DSN.