Download the PHP package fivepercent/error without Composer
On this page you can find all versions of the php package fivepercent/error. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download fivepercent/error
More information about fivepercent/error
Files in fivepercent/error
Download fivepercent/error
More information about fivepercent/error
Files in fivepercent/error
Vendor fivepercent
Package error
Short Description Control error codes with many systems
License MIT
Package error
Short Description Control error codes with many systems
License MIT
Please rate this library. Is it a good library?
Informations about the package error
Error
With this package, you can control error codes and exceptions in system with many sub systems.
Installation
Add FivePercent/Error in your composer.json:
{
"require": {
"fivepercent/error": "~1.0"
}
}
Now tell composer to download the library by running the command:
$ php composer.phar update fivepercent/error
Basic usage
For collect all error codes, you must create a error factory in you sub system:
use FivePercent\Component\Error\ErrorFactoryInterface;
final class MySystemError implements ErrorFactoryInterface
{
const ERROR_1 = 1;
const ERROR_2 = 2;
public function getErrors()
{
return [
self::ERROR_1 => 'Error #1',
self::ERROR_2 => 'Error #2'
];
}
public function getExceptions()
{
return [];
}
public function getReservedDiapason()
{
return [1, 5];
}
}
And create error system (Storage), and add this factory to storage:
use FivePercent\Component\Error\Errors;
$errors = new Errors();
$errors->addFactory(new MySystemError());
After, you can:
- Get reserved diapasons for each system .. code-block:: php $errors->getReservedCodes();
- Get all errors for system .. code-block:: php $errors->getErrors();
- Get all exceptions .. code-block:: php $exceptions = $errors->getExceptions();
- Check, if has exception in errors storage .. code-block:: php $exception = new \Exception(); $errors->hasException($exception);
- Get error code for exception .. code-block:: php $exception = new \Exception(); $code = $errors->getExceptionCode($exception);
- Check reserved codes .. code-block:: php $errors->checkReservedCodes();
All versions of error with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.4
The package fivepercent/error contains the following files
Loading the files please wait ....