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: 103 | All time: 9,767 This week: 455 |
Version | License | PHP version | Categories | |||
exceptionizer-bundle 1.0 | MIT/X Consortium ... | 5.3.9 | PHP 5, Language |
Description | Author | ||||||||
This package can throw exceptions that can be caught with listeners. |
|
Play with Exceptions :D This bundle help to get a low coupling between exception class object in your code
Exceptionizer uses Composer, please checkout the composer website for more information.
The simple following command will install exceptionizer-bundle
into your project. It also add a new
entry in your composer.json
and update the composer.lock
as well.
$ composer require 'mabs/exceptionizer-bundle'
Then, you can enable it in your kernel:
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
...
new Mabs\ExceptionizerBundle\MabsExceptionizerBundle(),
...
Now you can use Exceptionizer service to throw Exceptions:
$this->container->get('exceptionizer')
->throwException('\\Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException', array('Your message'));
OR define your Exception in your config.yml file like this :
mabs_exceptionizer:
exceptions:
bar_code_exception:
class: Mabs\BarCodeBundle\Exception\BarCodeException
arguments: # optional
message: "bar code exception" # optional
code: 0 # optional
and pass the config key to the service:
$this->container->get('exceptionizer')->throwException('bar_code_exception');
ExceptionizerBundle provide two events:
namespace Mabs\ExceptionizerBundle;
final class ExceptionizerEvents
{
const EXCEPTIONIZER_PRE_THROW = 'exceptionizer.pre_throw';
const EXCEPTIONIZER_POST_CATCH = 'exceptionizer.post_catch';
}
<b>exceptionizer.pre_throw</b> : before throw Exception
<b>exceptionizer.post_catch</b>: (will be documented later when we speak about the Exception Catcher)
Now you can create Listeners to do a specific job when an exception will be thrown ;) and to learn more about the EventDispatcher Component in symfony2 pleaze read the documentation
This bundle is available under the MIT license.
Files (19) |
File | Role | Description | ||
---|---|---|---|---|
DependencyInjection (2 files) | ||||
Event (1 file) | ||||
EventListener (1 file) | ||||
Exception (1 file) | ||||
Exceptionizer (2 files, 1 directory) | ||||
Resources (1 directory) | ||||
Service (1 file) | ||||
Tests (1 directory) | ||||
.scrutinizer.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
ExceptionizerEvents.php | Class | Class source | ||
LICENSE | Lic. | Auxiliary data | ||
MabsExceptionizerBundle.php | Class | Class source | ||
README.md | Doc. | Auxiliary data |
Files (19) | / | DependencyInjection |
File | Role | Description |
---|---|---|
Configuration.php | Class | Class source |
MabsExceptionizerExtension.php | Class | Class source |
Files (19) | / | Exceptionizer |
File | Role | Description | ||
---|---|---|---|---|
Common (2 files) | ||||
Catcher.php | Class | Class source | ||
Thrower.php | Class | Class source |
Files (19) | / | Exceptionizer | / | Common |
File | Role | Description |
---|---|---|
CatcherInterface.php | Class | Class source |
ThrowerInterface.php | Class | Class source |
Files (19) | / | Resources | / | config |
File | Role | Description |
---|---|---|
config.yml | Data | Auxiliary data |
services.xml | Data | Auxiliary data |
Files (19) | / | Tests | / | Controller |
File | Role | Description |
---|---|---|
DefaultControllerTest.php | Test | Unit test script |
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.