saritasa / opbeat-laravel
Laravel integration for Opbeat (https://opbeat.com)
Installs: 2 444
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 9
Forks: 1
Open Issues: 1
Language:Shell
Requires
- php: >=5.5.9
- illuminate/support: 4.*|5.*
- madsleejensen/opbeat-php: ^2.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^1.8.0
- phpunit/phpunit: ^4.6.6
This package is auto-updated.
Last update: 2021-01-20 11:49:06 UTC
README
Laravel integration for opbeat.
Laravel 5.x
Install the saritasa/opbeat-laravel
package:
$ composer require saritasa/opbeat-laravel
Add the Opbeat service provider and facade in config/app.php
:
'providers' => array( // ... Opbeat\OpbeatLaravel\OpbeatLaravelServiceProvider::class, ) 'aliases' => array( // ... 'Opbeat' => Opbeat\OpbeatLaravel\OpbeatFacade::class, )
Add Opbeat reporting to App/Exceptions/Handler.php
:
public function report(Exception $e) { if ($this->shouldReport($e)) { app('opbeat')->captureException($e); } parent::report($e); }
Create the Opbeat configuration file (config/opbeat.php
):
$ php artisan vendor:publish --provider="Opbeat\OpbeatLaravel\OpbeatLaravelServiceProvider"
Add your DSN to .env
:
OPBEAT_APP_ID=bf948ea29c
OPBEAT_ORGANIZATION_ID=4c394af520484784a993cc8977e7c0ce
OPBEAT_ACCESS_TOKEN=3a21ef7091b4082d12b0280f81c7b02c74a657d5
Laravel 4.x
Install the saritasa/opbeat-laravel
package:
$ composer require saritasa/opbeat-laravel
Add the Opbeat service provider and facade in config/app.php
:
'providers' => array( // ... 'Opbeat\OpbeatLaravel\OpbeatLaravelServiceProvider', ) 'aliases' => array( // ... 'Opbeat' => 'Opbeat\OpbeatLaravel\OpbeatFacade', )
Create the Opbeat configuration file (config/opbeat.php
):
$ php artisan config:publish saritasa/opbeat-laravel
Lumen 5.x
Install the saritasa/opbeat-laravel
package:
$ composer require saritasa/opbeat-laravel
Register Opbeat in bootstrap/app.php
:
$app->register('Opbeat\OpbeatLaravel\OpbeatLumenServiceProvider'); # Opbeat must be registered before routes are included require __DIR__ . '/../app/Http/routes.php';
Add Opbeat reporting to app/Exceptions/Handler.php
:
public function report(Exception $e) { if ($this->shouldReport($e)) { app('opbeat')->captureException($e); } parent::report($e); }
Create the Opbeat configuration file (config/opbeat.php
):
<?php return [ /* |-------------------------------------------------------------------------- | Set up exception tracker https://opbeat.com/ |-------------------------------------------------------------------------- */ 'app_id' => env('OPBEAT_APP_ID', ''), 'organization_id' => env('OPBEAT_ORGANIZATION_ID', ''), 'access_token' => env('OPBEAT_ACCESS_TOKEN', ''), ];
Contributing
First, make sure you can run the test suite. Install development dependencies :
$ composer install
You may now use phpunit :
$ vendor/bin/phpunit