Download the PHP package fyre/error without Composer
On this page you can find all versions of the php package fyre/error. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package error
FyreError
FyreError is a free, open-source error handling library for PHP.
Table Of Contents
- Installation
- Basic Usage
- Methods
- Middleware
- Exceptions
- Http Exceptions
Installation
Using Composer
In PHP:
Basic Usage
$container
is a Container.$io
is a Console.$logManager
is a LogManager.$eventManager
is an EventManager.$config
is a Config.
Default configuration options will be resolved from the "Error" key in the Config.
$options
is an array containing the configuration options.level
is a number representing the error reporting level, and will default toE_ALL
.renderer
is a Closure that will be used to render an Exception, and will default to null.log
is a boolean indicating whether to log exception messages, and will default to true.
Autoloading
It is recommended to bind the ErrorHandler to the Container as a singleton.
Any dependencies will be injected automatically when loading from the Container.
Methods
Get Exception
Get the current Exception.
Get Renderer
Get the error renderer.
Register
Register the error handler.
Render
Render an Exception.
Set Renderer
Set the error renderer.
$renderer
is a Closure that accepts an Exception as the first argument.
The renderer should return a ClientResponse or a string.
Middleware
$errorHandler
is an ErrorHandler.
Any dependencies will be injected automatically when loading from the Container.
Handle
$request
is a ServerRequest.$next
is a Closure.
This method will return a ClientResponse.
Exceptions
Custom exceptions can be created by extending the Fyre\Error\Exceptions\Exception
class.
$message
is a string representing the error message.$code
is a number representing the error code, and will default to 500.$previous
is an Exception representing the previous exception, and will default to null.
Http Exceptions
Bad Request
400 Bad Request error.
Unauthorized
401 Unauthorized error.
Forbidden
403 Forbidden error.
Not Found
404 Not Found error.
Method Not Allowed
405 Method Not Allowed error.
Not Acceptable
406 Not Acceptable error.
Conflict
409 Conflict error.
Gone
410 Gone error.
Internal Server
500 Internal Server error.
Not Implemented
501 Not Implemented error.
Service Unavailable
503 Service Unavailable error.
All versions of error with dependencies
fyre/container Version ^1.0
fyre/event Version ^4.0
fyre/log Version ^6.0
fyre/middleware Version ^6.0
fyre/server Version ^4.0