Skip to content

ckamte/slim-framework-4-custom-error-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Custom Error Handler for Slim Framework 4

Using twig-view (as view) and monolog (as logger) containers.

usage

<?php
use App\Errors\ViewErrorHandler;
use DI\ContainerBuilder;
use Slim\Factory\AppFactory;

...

// Add Routing Middleware
$app->addRoutingMiddleware();

// Register Error Middleware
$displayErrorDetails = true; //from your settings
$errorMiddleware = $app->addErrorMiddleware($displayErrorDetails, true, true);

// Register Error Handler
$errorHandler = new ViewErrorHandler($app);
$errorMiddleware->setDefaultErrorHandler($errorHandler);

// Run Application
$app->run();

About

Slim Framework 4 custom error page with bootstrap 5

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published