This is ZF3 module that implements the notifier for Rollbar v.1.0. Catches and reports exceptions to Rollbar.com for alerts, reporting, and analysis.
- Install the rollbar-php by cloning it into
./vendor/
. - Clone this project into your
./vendor/
directory.
-
Add this project in your composer.json:
"repositories": [ { "type": "git", "url": "https://github.com/ProspectOne/yassa-rollbar" }, ],
...
"require": { "prospect-one/yassa-rollbar": "dev-master" }
-
Install this package by running the command:
$ php composer.phar update
-
Enabling it in your
application.config.php
file.<?php return array( 'modules' => array( 'Yassa\Rollbar', // must be added as the first module // ... ), // ... );
-
Copy
config/module.yassa.rollbar.global.php.dist
inproject/directory/config/autoload/
and remove.dist
extension.
The following options are available at that configuration file:
Yassa options:
- enabled - Switch On/Off module
- errorhandler - Register Rollbar as an error handler to log PHP errors
- exceptionhandler - Register Rollbar as an exception handler to log PHP exceptions
- shutdownfunction - Register Rollbar as an shutdown function
Rollbar 1.0 options, full list can be found at: rollbar-php Configuration references :
- access_token - Your project access token
- base_api_url - The base API url to post to. (default: https://api.rollbar.com/api/1/)
- branch - Name of the checked-out branch.
- capture_error_stacktraces - Record full stacktraces for PHP errors. (default: true)
- environment - Environment name. Any string up to 255 chars is OK. For best results, use "production" for your production environment. (default: production)
- error_sample_rates - Associative array mapping PHP error numbers to sample rates. Sample rates are ratio out of 1, e.g. 0 is "never report", 1 is "always report", and 0.1 is "report 10% of the time". Sampling is done on a per-error basis. (default: array(), meaning all errors are reported.)
- host - Server hostname. (default: null, which will defer to a call to gethostname() (or php_uname('n') if that function does not exist))
- logger - An object with a log($level, $message) method. Will be used by RollbarNotifier to log messages. errors E_USER_NOTICE or higher. (default: -1 (report all errors))
- person - An associative array describing the currently-logged-in user. Required: id, optional: username, email. All values are strings.
- person_fn - A function reference (string, etc. - anything that call_user_func can handle) returning an array like the one for 'person'
- root - Absolute path to the root of your application, not including the final /.
- scrub_fields - Array of field names to scrub out of POST. Values will be
replaced with astrickses. If overridiing, make sure to list all fields you want
to scrub, not just fields you want to add to the default. Param names are
converted to lowercase before comparing against the scrub list. (default:
array('passwd', 'password', 'secret', 'confirm_password', 'password_confirmation')
) - shift_function - Whether to shift function names in stack traces down one frame, so that the function name correctly reflects the context of each frame. (default: true)
- timeout - Request timeout for posting to Rollbar, in seconds. (default: 3)