Skip to content

Laravel

Installation

To implement Latta into Laravel backend do:

Install Latta Recorder via Composer

Terminal window
composer require lattaai/latta-laravel-recorder

Setup

Insert API Key into ENV File

Terminal window
LATTA_API_KEY="YOUR_API_KEY"

Usage

Add lines to bootstrap/app.php into withExceptions() function

->withExceptions(function (Exceptions $exceptions) {
$exceptions->report(function (Throwable $e) {
$lattaRecorder = new LattaLaravelRecorder(env('LATTA_API_KEY'));
$lattaRecorder->reportError($e);
});
})->create();

Add lines to app/providers/AppServiceProvider.php into boot function

public function boot(): void
{
$lattaRecorder = new LattaLaravelRecorder(env('LATTA_API_KEY'));
$lattaRecorder->startRecording("Laravel", app()->version(), PHP_OS, "en", "server");
}