Download the PHP package biller/yii2-phpbrake without Composer
On this page you can find all versions of the php package biller/yii2-phpbrake. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-phpbrake
yii2-airbrake
Airbrake integration for Yii2, which wraps around official Airbrake PHP library (airbrake/phpbrake).
Installation
composer require biller/yii2-airbrake
Usage
While it is not explicitly required, it is recommended to configure the AirbrakeService
as a component in environment (or even common) configuration, so it is easily accessible from the whole application (
using i.e. Yii::$app->get('airbrakeService')
).
Configuration options marked with asterisk are required, all other options are optional.
rootDirectory
: should be set to your sources root to allow shortening of file pathshttpClient
: specifies type of HTTP client to use and can be configured as:AirbrakeService::CLIENT_DEFAULT
AirbrakeService::CLIENT_GUZZLE
AirbrakeService::CLIENT_CURL
setGlobalInstance
: if set totrue
, current instance will be set as global instancesetErrorHandler
: if set totrue
, current instance will be set as PHP run-time unhandled exception handlerfilters
: array of callables providing notice pre-processing
For additional information about the API, please consult official Airbrake PHP library documentation.
AirbrakeFilterFactory
Factory class that can be used to create various filtering rules.
AirbrakeFilterFactory::createParamsFilter(array $params, $replacement = 'FILTERED')
Method will create filtering callable that filters parameters, specified by
$params
and replaces it with specified $replacement
. Example usage is available above.
Console Support
Integration can be added to Yii console, where it currently provides a command to track deployment (new feature in Airbrake API 4 that allows to mark error timeline with deployments).
Usage
To use ConsoleController
, AirbrakeService
should be configured as component.
import enscope\Yii2\Ext\Airbrake\ConsoleController;
return [
// ...
'controllerMap' => [
// ...
'airbrake' => [
'class' => ConsoleController::class,
'airbrakeService' => [component-name], // default "airbrakeService"
],
],
];
While parameters can be hard-coded in configuration, console controller supports inferParameters
, username
, revision
and repository
parameters to be set by arguments on command line.
airbrakeService
: name of the component or initialized instanceinferParameters
: if TRUE,repository
andrevision
are discovered usingexec()
callsrevision
: identifier of the revision, discovered bygit rev-parse HEAD
if infer allowedrepository
: identifier of the repository, discovered bygit remote get-url origin
if infer allowedusername
: name of the user tracking deploy (default "system")
Logging Target
You can configure Yii2 logger to log errors automatically to Airbrake Service.
Usage
To use ConsoleController
, AirbrakeService
should be configured as component.
The target currently does not expose any other configuration options other then those exposed by yii\log\Target
,
except the service component:
airbrakeService
: name of the component or initialized instance
License
Yii2 Airbrake integration is licensed under The MIT License (MIT) as is the original PHP Airbrake library and follows the versioning of that library.