Install the streply/streply-laravel
package:
composer require streply/streply-laravel
This step is needed only for Laravel versions below 11.X.
Streply\Laravel\ServiceProvider::class,
Enable capturing exception in bootstrap/app.php:
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
$exceptions->reportable(static function (Throwable $exception) {
\Streply\Exception($exception);
});
})->create();
Enable capturing exception in App/Exceptions/Handler.php:
<?php
public function register()
{
$this->reportable(function (Throwable $e) {
try {
\Streply\Exception($e);
} catch(\Exception $e) {}
});
}
Configure the Streply DSN with this command:
php artisan streply:publish https://clientPublicKey@api.streply.com/projectId