Skip to content

Instantly share code, notes, and snippets.

@madebydavid
Last active December 25, 2015 12:19
Show Gist options
  • Save madebydavid/6976097 to your computer and use it in GitHub Desktop.
Save madebydavid/6976097 to your computer and use it in GitHub Desktop.
Silex Web Profile Issue
{
"require": {
"silex/silex": "~1.1",
"silex/web-profiler": "~1.0",
"twig/twig": ">=1.8,<2.0-dev"
}
}
<?php
require_once __DIR__.'/vendor/autoload.php';
$app = new Silex\Application();
$app['debug'] = true;
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__
));
/* Offending line? */
$app['twig']->addGlobal('foo', 'bar');
$app->register(new Silex\Provider\ServiceControllerServiceProvider());
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
$app->register($p = new Silex\Provider\WebProfilerServiceProvider(), array(
'profiler.cache_dir' => __DIR__.'/cache/profiler',
'profiler.mount_prefix' => '/_profiler',
));
$app->match('/', function () use ($app) {
return $app['twig']->render('index.twig');
});
$app->run();
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>TEST</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment