PHP code example of dopesong / slim-whoops
1. Go to this page and download the library: Download dopesong/slim-whoops library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dopesong / slim-whoops example snippets
use Dopesong\Slim\Error\Whoops as WhoopsError;
ontainer();
$container['phpErrorHandler'] = $container['errorHandler'] = function($c) {
return new WhoopsError();
};
$app->run();
use Whoops\Handler\Handler;
use Dopesong\Slim\Error\Whoops as WhoopsError;
$app = new Slim\App();
$container = $app->getContainer();
$container['phpErrorHandler'] = $container['errorHandler'] = function ($container) {
$logger = $container['logger'];
$whoopsHandler = new WhoopsError();
$whoopsHandler->pushHandler(
function ($exception) use ($logger) {
/** @var \Exception $exception */
$logger->error($exception->getMessage(), ['exception' => $exception]);
return Handler::DONE;
}
);
return $whoopsHandler;
};