setting up slim framework

Notice: This thread is very old.
cacoch
Member | 7
+
0
-

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

Blizard
Member | 45
+
0
-

I have the same problem.

yarri
Member | 1
+
0
-

Try the following:

<?php
use Tracy\Debugger;
Debugger::enable(false);
?>

Is the floating panel displayed?

cacoch
Member | 7
+
0
-

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 | 2565
+
+1
-

You need to tell Slim not to add Content-Length with incorrect value.

$config = [
    'settings' => [
        'displayErrorDetails' => TRUE,
	    'addContentLengthHeader' => FALSE,
    ],
];
cacoch
Member | 7
+
0
-

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 | 2565
+
0
-

@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.

David Grudl
Nette Core | 7417
+
0
-

…or returns something before JS code.

Or https://forum.nette.org/…nette-2-4-rc#…

cacoch
Member | 7
+
0
-

well, something wrong with apache. with php build-in server work fine. I will read with care David post.

Thx