, (*1)
Exceptiontrap PHP
This Exceptiontrap notifier class is used to catch and send exceptions and errors of your PHP (and Zend Framework) applications to the Exceptiontrap webservice., (*2)
The class is compatible with PHP >= 5.2, (*3)
Setup
PHP
1. Install
Download the class and copy it to your desired folder (e.g. Exceptiontrap/) in your include path., (*4)
Now insert the following lines into your applications codebase., (*5)
require_once 'Exceptiontrap/Exceptiontrap.php';
Exceptiontrap::setup('YOUR_API_KEY', true, 'YOUR_APPLICATION_ENV');
and you should be fine., (*6)
Zend Framework 1.x
1. Install
Download the class from here and copy it to your desired library folder (e.g. /libraries/Exceptiontrap/)., (*7)
Now insert the following lines into your applications codebase., (*8)
require_once 'Exceptiontrap/Exceptiontrap.php';
Exceptiontrap::setup('YOUR_API_KEY', true, 'YOUR_APPLICATION_ENV');
3. Register Plugin for better integration
If you use the Bootstrap class insert the following method., (*9)
protected function _initExceptiontrap(){
Zend_Controller_Front::getInstance()->registerPlugin(new Exceptiontrap_Services_Zf1ErrorHandler());
}
Or register the plugin manually to the front controller., (*10)
$controller = Zend_Controller_Front::getInstance();
$controller->registerPlugin(new Exceptiontrap_Services_Zf1ErrorHandler());
Other Frameworks (Symfony, CodeIgniter, Lithium, ...)
Until the class is extended to support other frameworks directly as a plugin, you can set the request-components by yourself. The setRequestComponents class method expects an associated array to do this., (*11)
Exceptiontrap::setRequestComponents(array(
'module' => 'YOUR_CURRENT_MODULE',
'controller' => 'YOUR_CURRENT_CONTROLLER',
'action' => 'YOUR_CURRENT_ACTION'
));
You can find your API-Key by login to your Exceptiontrap Account, select the application and follow the Setup Link., (*12)
If there is data in your request parameters, session or environment, which you don't want to be sent to Exceptiontrap, define them as follows:, (*13)
Exceptiontrap::setFilterParams(array('HTTP_COOKIE', '_app_session', 'password'));
You can also specify exceptions and errors, which should be ignored and not sent., (*14)
Exceptiontrap::setIgnoreList(array('InvalidArgumentException', 'Zend_Translate_Exception'));
Known Issues / Todo
- Optimize and insert the test suite to plugin.
- Better integration for other frameworks.
Copyright (c) 2014 [Torsten Bühl], released under the MIT license, (*15)