- 04 Apr, 2011 5 commits
-
-
Igor Wiedler authored
-
Igor Wiedler authored
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Fabien Potencier authored
* igorw/docs: [docs] note that twig is not included [docs] add Extension suffix to extension titles [docs] some documentation for the UrlGeneratorExtension [docs] better examples for the extensions chapter [docs] remove reference to symfony_bridges in TwigExtension docs [docs] move extension documentation to sub-directory [docs] remove _exts [docs] more on routes and twig [docs] initial documentation draft
-
- 03 Apr, 2011 7 commits
-
-
Igor Wiedler authored
-
Igor Wiedler authored
-
Igor Wiedler authored
-
Igor Wiedler authored
-
Igor Wiedler authored
-
Igor Wiedler authored
-
Igor Wiedler authored
-
- 02 Apr, 2011 3 commits
-
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Bulat Shakirzyanov authored
-
- 01 Apr, 2011 2 commits
-
-
Igor Wiedler authored
-
Igor Wiedler authored
-
- 31 Mar, 2011 1 commit
-
-
Fabien Potencier authored
-
- 30 Mar, 2011 2 commits
-
-
Igor Wiedler authored
note: only twig and monolog extensions have been documented so far
-
Fabien Potencier authored
-
- 29 Mar, 2011 6 commits
-
-
Fabien Potencier authored
-
Fabien Potencier authored
* igorw/extension-tests: [UrlGeneratorExtension] initial test case [SessionExtension] initial test case [TwigExtension] initial test case
-
Igor Wiedler authored
-
Igor Wiedler authored
-
Igor Wiedler authored
-
Igor Wiedler authored
-
- 28 Mar, 2011 4 commits
-
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Fabien Potencier authored
Usage: $app = new Application(); $app->register(new TranslationExtension(), array( 'translation.class_path' => '...', )); $app['translator.messages'] = array( 'en' => array( 'apple' => 'apple', ), 'fr' => array( 'apple' => 'pomme', ), ); $app['locale'] = 'fr'; echo $app['translator']->trans('apple'); If you use the Symfony Bridge extension, some tags and filters are also automatically available in templates: $templates = array( 'index' => '{% trans %}apple{% endtrans %}' );
-
Fabien Potencier authored
For now, it allows the Twig extension to register the Routing Twig extension: $app = new Application(); $app->register(new SymfonyBridgesExtension(), array( 'symfony_bridges.class_path' => '...', )); $app->register(new UrlGeneratorExtension()); $app->register(new SessionExtension()); $app->register(new TwigExtension(), array(...)); You can now use {{ path() }} in templates to generate URLs. The order of registration of the extensions is significant.
-
- 27 Mar, 2011 10 commits
-
-
Fabien Potencier authored
-
Fabien Potencier authored
* igorw/urlgenerator: [UrlGeneratorExtension] service for generating URLs for routes
-
Fabien Potencier authored
* igorw/beforefilter-httpexception: [Application] onSilexBefore should fire on BaseHttpException
-
Igor Wiedler authored
Usage example: $app->register(new UrlGeneratorExtension()); $app->get('/hello/:name', function($name) { return "Hello $name!"; }) ->bind('hello'); $app->get('/go', function() use ($app) { $url = $app['url_generator']->generate('hello', array('name' => 'Fabien')); return $app->redirect($url); }); Thanks to @choffmeister.
-
Igor Wiedler authored
-
Igor Wiedler authored
-
Igor Wiedler authored
Sample usage: $app = new Application(); $app->register(new MonologExtension(), array( 'monolog.class_path' => __DIR__.'/vendor/monolog/src', 'monolog.logfile' => __DIR__.'/application.log', )); $app->get('/hello', function() use ($app) { $app['monolog']->addDebug('currently at hello'); return 'Hello World!'; }); $app->get('/error', function() { throw new RuntimeException('Some error'); }); $app->run();
-
Fabien Potencier authored
This is also to avoid confusion with the fluid interface we now have for controllers.
-
Fabien Potencier authored
$app->get('/{id}', function($id) { // ... })->assert('id', '\d+');
-
Fabien Potencier authored
Usage: use Silex\Application; use Silex\Extension\TwigExtension; require_once __DIR__.'/silex.phar'; $app = new Application(); $templates = array( 'hello' => 'Hello {{ name }}', ); $app->register(new TwigExtension(), array( 'twig.templates' => $templates, 'twig.class_path' => '/path/to//Twig/lib', )); $app->get('/{name}', function($name) use ($app) { return $app['twig']->render('hello', array('name' => $name)); }); $app->run();
-