Download the PHP package morrislaptop/error-tracker-adapter without Composer
On this page you can find all versions of the php package morrislaptop/error-tracker-adapter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download morrislaptop/error-tracker-adapter
More information about morrislaptop/error-tracker-adapter
Files in morrislaptop/error-tracker-adapter
Package error-tracker-adapter
Short Description Track errors and exceptions through the most popular Saas platforms
License MIT
Informations about the package error-tracker-adapter
error-tracker-adapter
Track errors and exceptions through the most popular SaaS platforms.
Error Tracker Adapter is a PHP library which helps you track exceptions and errors in your application by providing a powerful abstraction layer for error tracker SaaS platforms and / or local repositories like emails and log files.
It has been created on three main principles:
- Code to an interface and not an implementation
- Protecting yourself from third party APIs breaking your application
- The ability to use chain or net like reporting for redundancy and/or increased reliability of errors being reported
Architecture
SaaS Platforms
SaaS platforms are supported via the use of adapters, the currently supported platforms are:
- [X] Sentry via raven/raven
- [X] Bugsnag via bugsnag/bugsnag
- [X] AirBrake via dbltr/php-airbrake
- [X] Rollbar via rollbar/rollbar
- [X] Exceptiontrap via exceptiontrap/exceptiontrap
- [X] Raygun via mindscape/raygun4php
- [ ] Bugify
Local Repositories
Local repositories like emails, logs or database are supported via the use of providers, the currently supported repositories are:
- [X] Email Repoter via error-tracker-adapter-email
- [X] Log Reporter
If you use Monolog, you now have the ability to log your exceptions into any of it's handlers - Pushover notifications, HipChat, Flowdock, Slack etc..
Grouping Trackers
Also, you can use Group trackers which can use multiple trackers in different ways:
- [X] Chain Reporter for reporting until one is successful (e.g. falling back to a log if Sentry is down)
- [X] Net Reporter for reporting to all trackers (e.g. logging AND reporting to Sentry for redundancy)
Extending Things
You can write your own provider or adapter by implementing the Tracker
interface. Optionally you can use the other interfaces Adapter
, Provider
or Group
and/or extend the abstract classes AbstractAdapter
, AbstractProvider
or AbstractGroup
to help classify your trackers.
Installation
The recommended way to install is through Composer:
Quick Start
For convenience, a generic exception handler is included with the library so you can quickly get started, by simply creating it and calling the bootstrap()
method.
Usage
The use of this library is a reporter and not a renderer. So it's recommended that you handle exceptions in your application with your own class and then report to the interface if it's the right error type and/or environment.
An example exception handler for your application might look like..
Group Providers
Contexts
Many platforms support the idea of contexts to give you more information about exceptions occuring in your application. This can happen on the user, environment or event level.
This will be implemented via a ContextInterface
in the future. In the mean time you can pass extra information via the report()
method like..
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
See CONTRIBUTING file.
Unit Tests
In order to run the test suite, install the developement dependencies:
Then, run the following command:
PHP-VCR is used to record the outgoing requests to the SaaS platforms and the requests are committed to the repo. By default PHP-VCR is set to not allow any requests that don't match the existing, verified request signatures. If you're sure that you've made a change that results in a different request and that should be recorded as the correct request you can:
- Update the
setMatchers()
function in your test to return true - Delete the fixture, run the test and commit the new signature
Versioning
Follows Semantic Versioning.
Credits
Inspiration:
License
MIT license. For the full copyright and license information, please read the LICENSE file that was distributed with this source code.