Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 171 | All time: 8,830 This week: 660 |
Version | License | PHP version | Categories | |||
php-error-handler 1.1.8 | MIT/X Consortium ... | 5.6 | PHP 5, Language |
Description | Author | |
This package can register handler for PHP errors and exceptions. |
PHP library for handling exceptions and errors.
This library is supported by PHP versions 5.6 or higher and is compatible with HHVM versions 3.0 or higher.
The preferred way to install this extension is through Composer.
To install PHP ErrorHandler library, simply:
$ composer require Josantonius/ErrorHandler
The previous command will only install the necessary files, if you prefer to download the entire source code you can use:
$ composer require Josantonius/ErrorHandler --prefer-source
You can also clone the complete repository with Git:
$ git clone https://github.com/Josantonius/PHP-ErrorHandler.git
Or install it manually:
$ wget https://raw.githubusercontent.com/Josantonius/PHP-ErrorHandler/master/src/ErrorHandler.php
Available methods in this library:
ErrorHandler::setCustomMethod($class, $method, $repeat, $default);
| Attribute | Description | Type | Required | Default | --- | --- | --- | --- | --- | | $class | Class name or class object. | callable | Yes | | | $method | Method name. | string| Yes | | | $repeat | Number of times to repeat method. | int | No | 0 | | $default | Show default view. | boolean | No | false |
# Return (void)
To use this class with Composer:
require __DIR__ . '/vendor/autoload.php';
use Josantonius\ErrorHandler\ErrorHandler;
Or If you installed it manually, use it:
require_once __DIR__ . '/ErrorHandler.php';
use Josantonius\ErrorHandler\ErrorHandler;
Example of use for this library:
/
It is recommended to instantiate the class in a base file as the index.php/
new ErrorHandler;
/
* Optionally you can enter one or more methods to be executed instead the
* default view. The indicated method will receive an array with the
* following parameters:
*
* [
* 'type' => 'Error|Exception',
* 'message' => 'exception|error message',
* 'file' => 'exception|error file',
* 'line ' => 'exception|error line',
* 'code' => 'exception|error code',
* 'http-code' => 'HTTP response status code',
* 'mode' => 'PHP|HHVM',
* ];
*
*/
$class = $this;
$method = 'customMethodResponse';
$times = 0;
$default = true;
ErrorHandler::SetCustomMethod($class, $method, $times, $default);
To run tests you just need composer and to execute the following:
$ git clone https://github.com/Josantonius/PHP-ErrorHandler.git
$ cd PHP-ErrorHandler
$ composer install
Run unit tests with PHPUnit:
$ composer phpunit
Run PSR2 code standard tests with PHPCS:
$ composer phpcs
Run PHP Mess Detector tests to detect inconsistencies in code style:
$ composer phpmd
Run all previous tests:
$ composer tests
If you would like to help, please take a look at the list of issues or the To Do checklist.
Pull requests
The file structure from this repository was created with PHP-Skeleton.
This project is licensed under MIT license. See the LICENSE file for more info.
2016 - 2018 Josantonius, josantonius.com
If you find it useful, let me know :wink:
Files (24) |
File | Role | Description | ||
---|---|---|---|---|
resources (1 directory) | ||||
src (1 file, 1 directory) | ||||
tests (1 file) | ||||
.editorconfig | Data | Auxiliary data | ||
.php_cs.dist | Example | Example script | ||
.travis.yml | Data | Auxiliary data | ||
CHANGELOG.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
CONDUCT.md | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpcs.xml | Data | Auxiliary data | ||
phpmd.xml | Data | Auxiliary data | ||
phpunit.xml | Data | Auxiliary data | ||
README-ES.md | Doc. | Documentation | ||
README.md | Doc. | Documentation |
Files (24) | / | resources | / | images |
File | Role | Description |
---|---|---|
error.png | Data | Auxiliary data |
example-error-hand...hvm-php-library.png | Data | Auxiliary data |
example-error-handler-php-library.png | Data | Auxiliary data |
example-exception-...hvm-php-library.png | Data | Auxiliary data |
example-exception-...ler-php-library.png | Data | Auxiliary data |
exception.png | Data | Auxiliary data |
notice.png | Data | Auxiliary data |
warning.png | Data | Auxiliary data |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.