Laravel
Install the Laravel instrumentation
Install the OpenTelemetry Laravel instrumentation package:
Shell
composer require open-telemetry/opentelemetry-auto-laravel
Configure Laravel
If you are using Laravel, you can require the appsignal.php file from the bootstrap/app.php file, before the Laravel application is created. This ensures that the OpenTelemetry SDK is initialized before Laravel starts handling requests.
bootstrap/app.php
<?php // ... // Add this before the application initialization require(base_path('appsignal.php')); // return Application::configure(...)
To be able to configure AppSignal using the .env file loaded by your Laravel application, load the environment variables for your app, then load the appsignal.php file, and then return the application instance:
bootstrap/app.php
<?php // Add this import use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; // Assign the previously returned app to a variable $app = Application::configure(basePath: dirname(__DIR__)) // ... ->create(); // Load the environment variables from the .env file (new LoadEnvironmentVariables())->bootstrap($app); // Load the AppSignal configuration require(base_path('appsignal.php')); // Return the app return $app;