Laravel
The official Streply library for the Laravel framework
Install
The first step is to download the streply/streply-laravel
package using the composer.
composer require streply/streply-laravel
Adding a service provider
Then add the Streply service definition to the config/app.php
file in an array in the providers
element.
'providers' => [ ..., Streply\StreplyLaravel\ServiceProvider::class ],
Catching errors
Once the service is defined, call the Streply\Exception
method in the App/Exceptions/Handler.php
file in the register method and pass the caught exception to it.
public function register() { $this->reportable(function (Throwable $e) { try { \Streply\Exception($e); } catch(\Exception $e) {} }); }
In Laravel version lower than 8.*, you need to call Streply\Exception
method in report
method:
public function report(Throwable $exception) { try { \Streply\Exception($exception); } catch(\Exception $e) {} parent::report($exception); }
Configuration
The final step is to add the configuration to the .env file using the streply-laravel:publish
command.
php artisan streply-laravel:publish https://clientPublicKey@api.streply.com/projectId
Package
streply/streply-laravel
Repository
https://github.com/streply/streply-laravel