It is easy to break the JavaScript in the application while doing some non-JS change. And if you don't have the browser console open, you may not notice it.
This Bundle injects a JavaScript handler, which converts JavaScript errors to alert()
. So they can't hide in the console unnoticed.
- Install the latest version with
composer require mhujer/javascript-error-handler-bundle
- Register the Bundle in the
AppKernel.php
:
<?php
class AppKernel extends \Symfony\Component\HttpKernel\Kernel
{
...
public function registerBundles()
{
$bundles = [
...
new \Mhujer\JavaScriptErrorHandlerBundle\JavaScriptErrorHandlerBundle(),
];
}
The Bundle is automatically enabled only in dev
mode (by using kernel.debug
configuration parameter).
You can configure it manually by adding this to your config.yml
:
java_script_error_handler:
enabled: true # or false
PHP 8.0+ and Symfony 5.4+.
- require Symfony 5.4+
- PHP 8.1 support
- require PHP 8.0+
- require Symfony 5.3+
- require PHP 7.4+
- require Symfony 4.4+/5.2+
- Symfony 5.0 compatibility
- Symfony 4.2 compatibility
- dropped support for PHP 7.1 as it is no longer supported
- PHP 7.3 compatibility
Fixed support for Symfony 4 and Flex
- #3 Symfony 4 + Flex support
As we are already using the Bundle at @driveto and with the new Symfony container tests, I'm fine with releasing it as 1.0.
- initial release