Download the PHP package kenny1911/symfony-http-exception without Composer
On this page you can find all versions of the php package kenny1911/symfony-http-exception. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kenny1911/symfony-http-exception
More information about kenny1911/symfony-http-exception
Files in kenny1911/symfony-http-exception
Package symfony-http-exception
Short Description The library provides a convenient way to convert PHP exceptions into Symfony HTTP exceptions with support for status codes, messages, headers, and translation capabilities.
License MIT
Informations about the package symfony-http-exception
Symfony HttpException
[ English | Русский ]
The kenny1911/symfony-http-exception
library provides a convenient way to convert PHP exceptions into Symfony HTTP exceptions with support for status codes, messages, headers, and translation capabilities.
Key Features
- Convert any exception to
HttpException
using attributes - Support for HTTP status codes, messages, headers, and translation parameters
- Built-in aliases for common HTTP errors
- Symfony Translation component integration
- Dynamic values using Symfony ExpressionLanguage
Installation
Install via Composer:
Register the event subscriber in your Symfony configuration:
Arguments
$translator
and$expressionLanguage
is not required
As the third argument $metadataLoader
, you can pass the instance of Kenny1911\SymfonyHttpException\Metadata\MetadataLoader
.
The default value is AttributeMetadataLoader
. Apart from this, there is also:
ArrayMetadataLoader
- use map exception class toBaseHttpException
instance.ConfigMetadataLoader
- use associative array for describe configuration.ChainMetadataLoader
- combine multiplyMetadataLoader
instances.
Эти загрузчики могут использоваться для описания сторонних классов исключения.
Example of advanced configuration:
Usage
Basic Example
Advanced Example
Built-in Aliases
License
This library is released under the MIT License.
All versions of symfony-http-exception with dependencies
symfony/event-dispatcher Version ^5.4 || ^6.0 || ^7.0
symfony/http-foundation Version ^5.4 || ^6.0 || ^7.0
symfony/http-kernel Version ^5.4 || ^6.0 || ^7.0
symfony/translation-contracts Version ^2.3|^3.0