emgiezet / errbit-php
errbit/airbrake integration with php with psr-2
Requires
- php: ^8.0||8.1||8.2||^8.3
- ext-simplexml: *
- guzzlehttp/guzzle: ^7.5.0
Requires (Dev)
- mockery/mockery: 1.5.1
- php-coveralls/php-coveralls: ^2.5
- phpstan/phpstan: ^1.9
- phpunit/phpunit: 9.4.4
- rector/rector: ^0.15.10
- vimeo/psalm: ^5.6
Replaces
- flippa-official/errbit-php: dev-master
- nodrew/php-airbrake: dev-master
- dev-master / 2.0.x-dev
- 2.0.2
- 2.0.1
- 2.0.0
- 1.1.1
- 1.1.0
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-feature/php8.3-support
- dev-psalm-fixes
- dev-insights-fixes
- dev-feature/coveralls-update
- dev-feature/php8.0-support
- dev-feature/php81
- dev-emgiezet-gh-actions
- dev-circleci-project-setup
- dev-php74
- dev-guzzle-transport
This package is auto-updated.
Last update: 2024-10-25 09:10:57 UTC
README
This is a full-featured client to add integration with Errbit (or Airbrake) to any PHP 8.0 and 8.1 application.
Original idea and source has no support for php namespaces. Moreover it has a bug and with newest errbit version the xml has not supported chars.
What is for?
Handling your errors and passing them to the Error Retention tool called Errbit. It's a free alternative of sentry.io or airbrake.io. Check the presentation below!
ChangeLog
Check the:
Installation
Composer Way
For php 5.3
require: { ... "emgiezet/errbit-php": "1.*" }
For php 8.0+
require: { ... "emgiezet/errbit-php": "2.*" }
Usage
To setup an Errbit instance you need to configure it with an array of parameters. Only two of them are mandatory.
use Errbit\Errbit; Errbit::instance() ->configure(array( 'api_key' => 'YOUR API KEY', 'host' => 'YOUR ERRBIT HOST, OR api.airbrake.io FOR AIRBRAKE' )) ->start();
View the full configuration.
This will register error handlers:
set_error_handler(); set_exception_handler(); register_shutdown_function();
And log all the errors intercepted by handlers to your errbit.
If you want to notify an exception manually, you can call notify()
without calling a start()
. That way you can avoid registering the handlers.
use Errbit\Errbit; try { somethingErrorProne(); } catch (Exception $e) { Errbit::instance()->notify( $e, array('controller'=>'UsersController', 'action'=>'show') ); }
Using your own error handler
If you don't want Errbit to install its own error handlers and prefer to use
your own, you can just leave out the call to start()
, then wherever you
catch an Exception (note the errors must be converted to Exceptions), simply
call
use Errbit\Errbit; Errbit::instance()->notify($exception);
With this type of use. Library will not handle the errors collected by:
set_error_handler(); register_shutdown_function();
Using only some of the default handlers
There are three error handlers installed by Errbit: exception, error and fatal.
By default all three are used. If you want to use your own for some handlers,
but not for others, pass the list into the start()
method.
use Errbit\Errbit; Errbit::instance()->start(array('error', 'fatal')); // using our own exception handler
Symfony2 Integration
See the documentation for symfony2 integration.
Kohana 3.3 Integration
check out the kohana-errbit for kohana 3.3 integration.
Symfony 1.4 Integration
No namespaces in php 5.2 so this library can't be used. Go to filipc/sfErrbitPlugin and monitor your legacy 1.4 applications.
License & Copyright
Copyright © mmx3.pl 2013 Licensed under the MIT license. Based on idea of git://github.com/flippa/errbit-php.git but rewritten in 90%.
Contributors
https://github.com/emgiezet/errbitPHP/graphs/contributors
Rest of the contributors: Author: emgiezet Contributors page