This bundles integrates an simple Exception Handler in your Symfony Application, which is capable of mailing the exact problem.
See the upgrade notes.
In order for this bundle to work, you are required to follow the following steps:
- Install the bundle:
php composer.phar require kick-in/exception-handler-bundle
- Enable the bundle in your
bundles.php
(if not done automatically)
$bundles = [
Kickin\ExceptionHandlerBundle\KickinExceptionHandlerBundle::class => ['all' => true],
];
- Choose the mail backend in the configuration. For example, for SwiftMailer:
kickin_exception_handler:
mail_backend: 'swift' # One of "swift"; "swift_mailer"; "symfony"; "symfony_mailer"
-
Implement your custom configuration service. This should implement either
Configuration\SwiftMailerConfigurationInterface
or
Configuration\SymfonyMailerConfigurationInterface
, depending on you mail backend choice.You can check a custom example implementation here.
-
Your configuration will be autowired to the correct ExceptionHandler if you have set
container.autowiring.strict_mode
to false. Otherwise, (default in Symfony >=4.0), alias theKickin\ExceptionHandlerBundle\Configuration\(Swift|Symfony)MailerConfigurationInterface
service to your custom configuration class. For example:
Kickin\ExceptionHandlerBundle\Configuration\SymfonyMailerConfigurationInterface:
alias: 'App\ExceptionHandler\ExceptionHandlerConfiguration'
- [SwiftMailer only] Create the
exception_mailer
SwiftMailer instance. For example:
swiftmailer:
default_mailer: default
mailers:
default:
transport: "%mailer_transport%"
exception_mailer:
transport: "%mailer_transport%"
spool: { type: memory }
That should be it, happy exception mailing!
The original functionality has been created by WendoB, while BobV splitted the codebase into a separate bundle making it configurable for more users.
If you experience any problems, do not hesitate to create an issue (or PR if you're able to fix it)!