Download the PHP package internations/exception-bundle without Composer
On this page you can find all versions of the php package internations/exception-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download internations/exception-bundle
More information about internations/exception-bundle
Files in internations/exception-bundle
Package exception-bundle
Short Description Helps making your Symfony Bundle a good Exception citizen. Yes, it’s opinionated.
License MIT
Informations about the package exception-bundle
ExceptionBundle
Clean exception handling for your Symfony 2 bundles
ExceptionBundle
helps you managing the exceptions of your bundle:
- Generate exception subclasses from command line including a marker interface
- Replace all global throw statements in a bundle with bundle specific exception classes
Why should you care?
- The simpler exceptions are distinguishable by type, the simpler exceptional conditions are handled
- Providing a marker interface all bundle exception classes implement allows clients to dramatically simplify exception handling
- Usually, creating all the exception sub classes by hand is cumbersome,
ExceptionBundle
can help you
Usage
Generate bundle specific exception subclasses
This command will generate a bunch of exceptions
ls app/src/MyVendor/MyBundle/Exception
cat app/src/MyVendor/MyBundle/Exception/RuntimeException.php
You can also specify the shortcut "spl" to subclass all Spl Exceptions
Rewrite bundle exceptions
ExceptionBundle
uses PHP Parser to rewrite all throw statements in a bundle code base.
cat app/src/MyVendor/MyBundle/MyClass.php
php app/console exception:rewrite app/src/MyVendor/MyBundle "MyVendor\MyBundle"
Rewrites the code to:
Installation
Add internations/exception-bundle
to your composer.json
and edit AppKernel.php
like this:
All versions of exception-bundle with dependencies
symfony/console Version ^3.0|^4.0
nikic/php-parser Version ~2|~3|~4
lstrojny/functional-php Version ~0|~1
php Version >=7.1