setting up slim framework
- cacoch
- Member | 7
how to setup slim framework with tracy. I installed it using composer and add two magic lines
<?php
use Tracy\Debugger;
Debugger::enable();
?>
to code http://www.slimframework.com/…rst-app.html and no floating panel, no error message.
any suggestion?
cacoch
Btw, im using apache
- cacoch
- Member | 7
doesn't work. When slim is commented, floating panel is displayed. There is whole index.php
use Tale\Jade;
use Tracy\Debugger;
// setup autoloader
$autoloader = require __DIR__ . '/../vendor/autoload.php';
$config = [
'settings' => [
'displayErrorDetails' => true,
],
];
$config_jade = [
'paths' => [__DIR__ . '/views'],
'pretty' => true ,
'cache_path' => __DIR__.'cache',
'ttl' => 10 //Will cache the file for 10 seconds
] ;
Debugger::enable(false);
$app = new \Slim\App($config);
$container = $app->getContainer();
$container['renderer'] = new Jade\Renderer($config_jade);
$app->get('/', function($request, $response, $arg) {
$body = $this->renderer->render('index') ;
return $response->write($body);
});
$app->get('/test', function($request, $response, $arg) {
$body = $this->renderer->render('test') ;
return $response->write($body);
});
$app->get('/hello/{name}', function (Request $request, Response $response) {
$name = $request->getAttribute('name');
$response->getBody()->write("Hello, $name");
return $response;
});
$app->run();
- Jan Tvrdík
- Nette guru | 2595
You need to tell Slim not to add Content-Length
with
incorrect value.
$config = [
'settings' => [
'displayErrorDetails' => TRUE,
'addContentLengthHeader' => FALSE,
],
];
- cacoch
- Member | 7
Zmenil jsem $config. Nemam zadny debugbar ale neco se tam deje. Kdyz, http://localhost:8080/hello/karel tak mam tenhle source “:http://pastie.org/10913656”:. Y javascript console mam 2 chyby.
localhost/:1 Uncaught SyntaxError: Unexpected token <
karel:10 Uncaught ReferenceError: Tracy is not defined
- Jan Tvrdík
- Nette guru | 2595
@cacoch When I copy & paste your HTML output into file and open it in a browser, it works fine. Not sure what else can I do for you.
Based on the error it seems that /?_tracy_bar=js&v=2.4.1
does not return the JS in your PC.