Commit 75556d7e authored by Fabien Potencier's avatar Fabien Potencier

removed the Symfony bridges provider as it is not needed anymore with Composer

parent 5b46a783
...@@ -3,6 +3,8 @@ Changelog ...@@ -3,6 +3,8 @@ Changelog
This changelog references all backward incompatibilities as we introduce them: This changelog references all backward incompatibilities as we introduce them:
* **2012-05-26**: Removed ``SymfonyBridgesServiceProvider``
* **2012-05-26**: Removed the ``translator.messages`` parameter (use * **2012-05-26**: Removed the ``translator.messages`` parameter (use
``translator.domains`` instead). ``translator.domains`` instead).
......
...@@ -8,7 +8,6 @@ Silex ...@@ -8,7 +8,6 @@ Silex
monolog monolog
session session
swiftmailer swiftmailer
symfony_bridges
translation translation
twig twig
url_generator url_generator
......
SymfonyBridgesServiceProvider
=============================
The *SymfonyBridgesServiceProvider* provides additional integration between
Symfony2 components and libraries.
Parameters
----------
none
Twig
----
When the ``SymfonyBridgesServiceProvider`` is enabled, the
``TwigServiceProvider`` will provide you with the following additional
capabilities:
* **UrlGeneratorServiceProvider**: If you are using the
``UrlGeneratorServiceProvider``, you will get ``path`` and ``url`` helpers
for Twig. You can find more information in the `Symfony2 Routing
documentation
<http://symfony.com/doc/current/book/routing.html#generating-urls-from-a-template>`_.
* **TranslationServiceProvider**: If you are using the
``TranslationServiceProvider``, you will get ``trans`` and ``transchoice``
helpers for translation in Twig templates. You can find more information in
the `Symfony2 Translation documentation
<http://symfony.com/doc/current/book/translation.html#twig-templates>`_.
* **FormServiceProvider**: If you are using the ``FormServiceProvider``, you
will get a set of helpers for working with forms in templates. You can find
more information in the `Symfony2 Forms reference
<http://symfony.com/doc/current/reference/forms/twig_reference.html>`_.
Registering
-----------
.. code-block:: php
$app->register(new Silex\Provider\SymfonyBridgesServiceProvider());
.. note::
The Symfony bridges do not come with the ``silex.zip`, so you need to add
them as a dependency to your ``composer.json`` file:
.. code-block:: json
"require": {
"symfony/twig-bridge": "2.1.*",
}
...@@ -53,6 +53,39 @@ Registering ...@@ -53,6 +53,39 @@ Registering
"twig/twig": ">=1.8,<2.0-dev" "twig/twig": ">=1.8,<2.0-dev"
} }
Symfony2 Components Integration
-------------------------------
Symfony provides a Twig bridge that provides additional integration between
some Symfony2 components and Twig. Add it as a dependency to your
``composer.json`` file:
.. code-block:: json
"require": {
"symfony/twig-bridge": "2.1.*",
}
When present, the ``TwigServiceProvider`` will provide you with the following
additional capabilities:
* **UrlGeneratorServiceProvider**: If you are using the
``UrlGeneratorServiceProvider``, you will have access to the ``path()`` and
``url()`` functions. You can find more information in the `Symfony2 Routing
documentation
<http://symfony.com/doc/current/book/routing.html#generating-urls-from-a-template>`_.
* **TranslationServiceProvider**: If you are using the
``TranslationServiceProvider``, you will get the ``trans()`` and
``transchoice()`` functions for translation in Twig templates. You can find
more information in the `Symfony2 Translation documentation
<http://symfony.com/doc/current/book/translation.html#twig-templates>`_.
* **FormServiceProvider**: If you are using the ``FormServiceProvider``, you
will get a set of helpers for working with forms in templates. You can find
more information in the `Symfony2 Forms reference
<http://symfony.com/doc/current/reference/forms/twig_reference.html>`_.
Usage Usage
----- -----
......
<?php
/*
* This file is part of the Silex framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Silex\Provider;
use Silex\Application;
use Silex\ServiceProviderInterface;
/**
* Symfony bridges Provider.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class SymfonyBridgesServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
$app['symfony_bridges'] = true;
}
}
...@@ -45,7 +45,7 @@ class TwigServiceProvider implements ServiceProviderInterface ...@@ -45,7 +45,7 @@ class TwigServiceProvider implements ServiceProviderInterface
$twig->addExtension(new \Twig_Extension_Debug()); $twig->addExtension(new \Twig_Extension_Debug());
} }
if (isset($app['symfony_bridges'])) { if (class_exists('Symfony\Bridge\Twig\TwigEngine')) {
if (isset($app['url_generator'])) { if (isset($app['url_generator'])) {
$twig->addExtension(new TwigRoutingExtension($app['url_generator'])); $twig->addExtension(new TwigRoutingExtension($app['url_generator']));
} }
......
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