Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/softius/exceptionist
Exception Handler for PHP 5.3
https://github.com/softius/exceptionist
Last synced: about 1 month ago
JSON representation
Exception Handler for PHP 5.3
- Host: GitHub
- URL: https://github.com/softius/exceptionist
- Owner: softius
- Created: 2013-01-20T12:20:08.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-02-19T12:02:16.000Z (almost 11 years ago)
- Last Synced: 2024-09-26T20:49:21.026Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 160 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
exceptionist
============Exceptionist provides exception handler for PHP 5.3+. Based on the application environment you can choose to display a detailed error report with stack trace or a mini report just mentioning the exception occured.
Installation
------------
Exceptionist is available on packagist. All you need is to add the following lines in your project `composer.json`:``` JSON
{
"require": {
"softius/exceptionist": "0.1"
}
}
```
and install via composer:```
php composer.phar install
```Then, you will need to setup `GenericExceptionHandler`. You are adviced to setup the following as early as possible in your script.
``` PHP
set_exception_handler(array(new \Exceptionist\GenericExceptionHandler(array('project_root' => 'project_root_dir')), 'handle'));
```Configuration
-------------`GenericExceptionHandler` accepts a configuration array with the following options:
* `project_root`: defines the project root directory, default is `null`.
* `template_script`: full path of the template to be used. The following built-in templates are available: `\Exceptionist\ExceptionReporter::TEMPLATE_DETAILED`
* `code_block_length`: number of lines to be displayed in each code block, default is 10.How it works
------------
`ExceptionHandler` is using `ExceptionReporter` class to generate and display exception reports. This happens only and only if an exception is thrown and not caught within a try/catch block. Templates are available in `templates` which can be copied, modified and adjusted to your needs, if necessary.