Commit 0139020e authored by Fabien Potencier's avatar Fabien Potencier

merged branch igorw/rework-docs (PR #144)

Commits
-------

bb402638 [docs] Symfony => Symfony2 in services doc
c51b99bd [docs] adjust usage section of twig
340b6ce2 [docs] add usage section for MonologExtension

Discussion
----------

Minor docs additions
parents 827e1cda bb402638
......@@ -50,3 +50,30 @@ directory::
'monolog.logfile' => __DIR__.'/development.log',
'monolog.class_path' => __DIR__.'/vendor/monolog/src',
));
.. note::
Monolog is not compiled into the ``silex.phar`` file. You have to
add your own copy of Monolog to your application.
Usage
-----
The MonologExtension provides a ``monolog`` service. You can use
it to add log entries for any logging level through ``addDebug()``,
``addInfo()``, ``addWarning()`` and ``addError()``.
::
use Symfony\Component\HttpFoundation\Response;
$app->post('/user', function () use ($app) {
// ...
$app['monolog']->addInfo(sprintf("User '%s' registered.", $username));
return new Response('', 201);
});
For more information, check out the `Monolog documentation
<https://github.com/Seldaek/monolog>`_.
......@@ -64,11 +64,16 @@ The Twig extension provides a ``twig`` service::
This will render a file named ``views/hello.twig``.
It also registers the application as a global named
``app``. So you can access any services from within your
view. For example to access ``$app['request']->getHost()``,
just put this in your template:
.. tip::
.. code-block:: jinja
The TwigExtension also registers the application as a global
named ``app``. So you can access any services from within your
view. For example to access ``$app['request']->getHost()``,
just put this in your template:
{{ app.request.host }}
.. code-block:: jinja
{{ app.request.host }}
For more information, check out the `Twig documentation
<http://www.twig-project.org>`_.
......@@ -205,7 +205,7 @@ of them.
$app['autoloader']->registerPrefix('Twig_', $app['twig.class_path']);
For more information, check out the `Symfony autoloader documentation
For more information, check out the `Symfony2 autoloader documentation
<http://symfony.com/doc/2.0/cookbook/tools/autoloader.html>`_.
* **routes**: The `RouteCollection
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment