Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slim 3 - Error is not shown

Tags:

php

slim

slim-3

I am trying to use zeuxisoo/slim-whoops to show errors, but for some reason I am only getting white screen without any message show. This is the code I am using (I don't know if it does matter, I am using quick PHP host (php -S localhost:8000):

require __DIR__ . '/../vendor/autoload.php';

$app = new Slim\App([

    'settings' => [
        'displayErrorDetails' => true,
        'debug'               => true,
        'whoops.editor'       => 'sublime',
    ]

]);

$app->add(new \Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware);
like image 206
Sasha Avatar asked Mar 05 '26 12:03

Sasha


1 Answers

Make sure that your file begins with <?php and that after your $app->add(...); you call $app->run();:

<?php
require __DIR__ . '/../vendor/autoload.php';

$app = new Slim\App([

    'settings' => [
        'displayErrorDetails' => true,
        'debug'               => true,
        'whoops.editor'       => 'sublime',
    ]

]);

$app->add(new \Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware);
$app->run();
like image 128
charmeleon Avatar answered Mar 08 '26 02:03

charmeleon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!