1. Go to this page and download the library: Download yusukezzz/slim-debugbar 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/ */
yusukezzz / slim-debugbar example snippets
ig = [];
// if you want to capture ajax requests, set instance of StorageInterface implemented.
// $config['debugbar.storage'] = new \DebugBar\Storage\FileStorage('/path/to/storage');
$slim = new \Slim\Slim($config);
$debugbar = new \Slim\Middleware\DebugBar();
// you can add custom collectors
// $debugbar->addCollector(new MyCustomCollector());
// or use custom debugbar
// $debugbar->setDebugBar(new MyCustomDebugBar());
$slim->add($debugbar);
$slim->get('/', function()
{
echo 'Hello world!';
});
$slim->run();
MyHttpDriver implements \DebugBar\HttpDriverInterface
{
protected $session;
protected $response;
public function __construct(YourSessionManager $session, \Slim\Http\Response $response)
{
$this->session = $session;
$this->response = $response;
}
public function setHeaders(array $headers)
{
foreach ($headers as $key => $val) {
$this->response->header($key, $val);
}
}
public function isSessionStarted()
{
return $this->session->isStarted();
}
// You should implement other methods too
}
$slim = new \Slim\Slim();
$slim->container->singleton('session', function()
{
return new YourSessionManager();
});
$driver = new MyHttpDriver($slim->session, $slim->response);
$debugbar = new \Slim\Middleware\DebugBar($driver);
$slim->add($debugbar);
$slim->get('/', function()
{
echo 'Hello world!';
});
$slim->get('/redirect', function() use ($slim)
{
$slim->response->redirect('/');
});
$slim->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.