portrino / typo3-whoops
Whoops error/ exception handler for TYPO3 projects
Installs: 3 380
Dependents: 1
Suggesters: 0
Security: 0
Stars: 9
Watchers: 9
Forks: 0
Open Issues: 2
Requires
- filp/whoops: ~2.1.0
- typo3/cms: ^7.6 || ^8.7
Requires (Dev)
- codeception/codeception: ~2.3.6
- helhum/typo3-console: ^4.9
- squizlabs/php_codesniffer: ~3.0.2
This package is auto-updated.
Last update: 2024-02-20 01:01:02 UTC
README
Use the whoops error/ exception handler instead of the default DebugExceptionHandler shipped within the TYPO3 core. This supports you with a nicer exception handling output in the frontend or on cli during extension development. Should only be used in a (local) development context!
Getting started
Install using composer
$ composer require --dev portrino/typo3-whoops
Activation
via AdditionalConfiguration.php
Add the following lines into your typo3conf/AdditionalConfiguration.php
:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'] = \Portrino\Typo3Whoops\Error\WhoopsExceptionHandler::class; $GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'] = \Portrino\Typo3Whoops\Error\WhoopsExceptionHandler::class;
We highly recommend to use a context related condition around it. For example:
$applicationContext = \TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext()->__toString(); if (strpos($applicationContext, 'Development') !== false) { $GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'] = \Portrino\Typo3Whoops\Error\WhoopsExceptionHandler::class; $GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'] = \Portrino\Typo3Whoops\Error\WhoopsExceptionHandler::class; }
Compatibility for PHP versions < 7
Because the ExceptionHandlerInterface
under php5.5 and 5.6 differs from the one from php > 7
we provide you a compatible version of the WhoopsExceptionHandler
.
$GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'] = \Portrino\Typo3Whoops\Compatibility\Error\WhoopsExceptionHandler::class; $GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'] = \Portrino\Typo3Whoops\Compatibility\Error\WhoopsExceptionHandler::class;
via TYPO3 Console
typo3cms configuration:set --path SYS/debugExceptionHandler --value "Portrino\\Typo3Whoops\\Error\\WhoopsExceptionHandler" typo3cms configuration:set --path SYS/productionExceptionHandler --value "Portrino\\Typo3Whoops\\Error\\WhoopsExceptionHandler"
Usage
Now trigger an exception somewhere in your extension code and you should see php errors for cool kids.
Authors
- Axel Böswetter - Initial work - EvilBMP
- André Wuttig - Bugfixes, Unit Tests, Acceptance Tests, Travis CI Integration - aWuttig
See also the list of contributors who participated in this project.