Commit 29076993 authored by Fabien Potencier's avatar Fabien Potencier

simplified Composer instructions

parent 2603afb3
...@@ -23,17 +23,11 @@ Silex works with PHP 5.3.3 or later. ...@@ -23,17 +23,11 @@ Silex works with PHP 5.3.3 or later.
Installation Installation
------------ ------------
The recommended way to install Silex is through `Composer`_. Just create a The recommended way to install Silex is through `Composer`_:
``composer.json`` file and run the ``php composer.phar install`` command to
install it:
.. code-block:: json .. code-block:: bash
{ composer require "silex/silex:~1.2"
"require": {
"silex/silex": "~1.1"
}
}
Alternatively, you can download the `silex.zip`_ file and extract it. Alternatively, you can download the `silex.zip`_ file and extract it.
......
...@@ -5,14 +5,11 @@ Simplicity is at the heart of Silex so there is no out of the box solution to ...@@ -5,14 +5,11 @@ Simplicity is at the heart of Silex so there is no out of the box solution to
use YAML files for validation. But this doesn't mean that this is not use YAML files for validation. But this doesn't mean that this is not
possible. Let's see how to do it. possible. Let's see how to do it.
First, you need to install the YAML Component. Declare it as a dependency in First, you need to install the YAML Component:
your ``composer.json`` file:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/yaml
"symfony/yaml": "~2.3"
}
Next, you need to tell the Validation Service that you are not using Next, you need to tell the Validation Service that you are not using
``StaticMethodLoader`` to load your class metadata but a YAML file:: ``StaticMethodLoader`` to load your class metadata but a YAML file::
......
...@@ -67,14 +67,11 @@ Registering ...@@ -67,14 +67,11 @@ Registering
.. note:: .. note::
Doctrine DBAL comes with the "fat" Silex archive but not with the regular Doctrine DBAL comes with the "fat" Silex archive but not with the regular
one. If you are using Composer, add it as a dependency to your one. If you are using Composer, add it as a dependency:
``composer.json`` file:
.. code-block:: json .. code-block:: bash
"require": { composer require "doctrine/dbal:~2.2"
"doctrine/dbal": "2.2.*",
}
Usage Usage
----- -----
......
...@@ -46,54 +46,40 @@ Registering ...@@ -46,54 +46,40 @@ Registering
.. note:: .. note::
The Symfony Form Component and all its dependencies (optional or not) comes The Symfony Form Component and all its dependencies (optional or not) comes
with the "fat" Silex archive but not with the regular one. with the "fat" Silex archive but not with the regular one. If you are using
Composer, add it as a dependency:
If you are using Composer, add it as a dependency to your .. code-block:: bash
``composer.json`` file:
.. code-block:: json composer require symfony/form
"require": {
"symfony/form": "~2.3"
}
If you are going to use the validation extension with forms, you must also If you are going to use the validation extension with forms, you must also
add a dependency to the ``symfony/config`` and ``symfony/translation`` add a dependency to the ``symfony/config`` and ``symfony/translation``
components: components:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/validator symfony/config symfony/translation
"symfony/validator": "~2.3",
"symfony/config": "~2.3",
"symfony/translation": "~2.3"
}
The Symfony Form Component relies on the PHP intl extension. If you don't have The Symfony Form Component relies on the PHP intl extension. If you don't have
it, you can install the Symfony Locale Component as a replacement: it, you can install the Symfony Locale Component as a replacement:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/locale
"symfony/locale": "~2.3"
}
The Symfony Security CSRF component is used to protect forms against CSRF attacks: The Symfony Security CSRF component is used to protect forms against CSRF attacks:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/security-csrf
"symfony/security-csrf": "~2.4"
}
If you want to use forms in your Twig templates, make sure to install the If you want to use forms in your Twig templates, make sure to install the
Symfony Twig Bridge: Symfony Twig Bridge:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/twig-bridge
"symfony/twig-bridge": "~2.3"
}
Usage Usage
----- -----
......
...@@ -51,14 +51,11 @@ Registering ...@@ -51,14 +51,11 @@ Registering
.. note:: .. note::
Monolog comes with the "fat" Silex archive but not with the regular one. Monolog comes with the "fat" Silex archive but not with the regular one.
If you are using Composer, add it as a dependency to your If you are using Composer, add it as a dependency:
``composer.json`` file:
.. code-block:: json .. code-block:: bash
"require": { composer require monolog/monolog
"monolog/monolog": ">=1.0.0"
}
Usage Usage
----- -----
......
...@@ -55,14 +55,11 @@ Registering ...@@ -55,14 +55,11 @@ Registering
.. note:: .. note::
The Symfony Security Component comes with the "fat" Silex archive but not The Symfony Security Component comes with the "fat" Silex archive but not
with the regular one. If you are using Composer, add it as a dependency to with the regular one. If you are using Composer, add it as a dependency:
your ``composer.json`` file:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/security
"symfony/security": "~2.3"
}
.. caution:: .. caution::
......
...@@ -36,14 +36,11 @@ Registering ...@@ -36,14 +36,11 @@ Registering
The *SerializerServiceProvider* relies on Symfony's `Serializer Component The *SerializerServiceProvider* relies on Symfony's `Serializer Component
<http://symfony.com/doc/current/components/serializer.html>`_, <http://symfony.com/doc/current/components/serializer.html>`_,
which comes with the "fat" Silex archive but not with the regular which comes with the "fat" Silex archive but not with the regular
one. If you are using Composer, add it as a dependency to your one. If you are using Composer, add it as a dependency:
``composer.json`` file:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/serializer
"symfony/serializer": ">=2.3,<2.5-dev",
}
Usage Usage
----- -----
......
...@@ -69,14 +69,11 @@ Registering ...@@ -69,14 +69,11 @@ Registering
.. note:: .. note::
SwiftMailer comes with the "fat" Silex archive but not with the regular SwiftMailer comes with the "fat" Silex archive but not with the regular
one. If you are using Composer, add it as a dependency to your one. If you are using Composer, add it as a dependency:
``composer.json`` file:
.. code-block:: json .. code-block:: bash
"require": { composer require swiftmailer/swiftmailer
"swiftmailer/swiftmailer": ">=4.1.2,<4.2-dev"
}
Usage Usage
----- -----
......
...@@ -45,13 +45,11 @@ Registering ...@@ -45,13 +45,11 @@ Registering
The Symfony Translation Component comes with the "fat" Silex archive but The Symfony Translation Component comes with the "fat" Silex archive but
not with the regular one. If you are using Composer, add it as a not with the regular one. If you are using Composer, add it as a
dependency to your ``composer.json`` file: dependency:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/translation
"symfony/translation": "~2.3"
}
Usage Usage
----- -----
...@@ -120,15 +118,11 @@ YAML-based language files ...@@ -120,15 +118,11 @@ YAML-based language files
Having your translations in PHP files can be inconvenient. This recipe will Having your translations in PHP files can be inconvenient. This recipe will
show you how to load translations from external YAML files. show you how to load translations from external YAML files.
First, add the Symfony2 ``Config`` and ``Yaml`` components in your composer First, add the Symfony2 ``Config`` and ``Yaml`` components as dependencies:
file:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/config symfony/yaml
"symfony/config": "~2.3",
"symfony/yaml": "~2.3"
}
Next, you have to create the language mappings in YAML files. A naming you can Next, you have to create the language mappings in YAML files. A naming you can
use is ``locales/en.yml``. Just do the mapping in this file as follows: use is ``locales/en.yml``. Just do the mapping in this file as follows:
......
...@@ -42,27 +42,21 @@ Registering ...@@ -42,27 +42,21 @@ Registering
.. note:: .. note::
Twig comes with the "fat" Silex archive but not with the regular one. If Twig comes with the "fat" Silex archive but not with the regular one. If
you are using Composer, add it as a dependency to your ``composer.json`` you are using Composer, add it as a dependency:
file:
.. code-block:: json .. code-block:: bash
"require": { composer require twig/twig
"twig/twig": ">=1.8,<2.0-dev"
}
Symfony2 Components Integration Symfony2 Components Integration
------------------------------- -------------------------------
Symfony provides a Twig bridge that provides additional integration between Symfony provides a Twig bridge that provides additional integration between
some Symfony2 components and Twig. Add it as a dependency to your some Symfony2 components and Twig. Add it as a dependency:
``composer.json`` file:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/twig-bridge
"symfony/twig-bridge": "~2.3"
}
When present, the ``TwigServiceProvider`` will provide you with the following When present, the ``TwigServiceProvider`` will provide you with the following
additional capabilities: additional capabilities:
......
...@@ -54,8 +54,8 @@ When using Twig, the service can be used like this: ...@@ -54,8 +54,8 @@ When using Twig, the service can be used like this:
{{ app.url_generator.generate('homepage') }} {{ app.url_generator.generate('homepage') }}
Moreover, if you have ``twig-bridge`` in your ``composer.json``, you will have access to the ``path()`` and Moreover, if you have ``twig-bridge`` as a Composer dep, you will have access
``url()`` functions: to the ``path()`` and ``url()`` functions:
.. code-block:: jinja .. code-block:: jinja
......
...@@ -38,14 +38,11 @@ Registering ...@@ -38,14 +38,11 @@ Registering
.. note:: .. note::
The Symfony Validator Component comes with the "fat" Silex archive but not The Symfony Validator Component comes with the "fat" Silex archive but not
with the regular one. If you are using Composer, add it as a dependency to with the regular one. If you are using Composer, add it as a dependency:
your ``composer.json`` file:
.. code-block:: json .. code-block:: bash
"require": { composer require symfony/validator
"symfony/validator": "~2.3"
}
Usage Usage
----- -----
......
...@@ -79,15 +79,11 @@ use it by making your test extend it:: ...@@ -79,15 +79,11 @@ use it by making your test extend it::
.. note:: .. note::
If you want to use the Symfony2 ``WebTestCase`` class you will need to If you want to use the Symfony2 ``WebTestCase`` class you will need to
explicitly install its dependencies for your project. Add the following to explicitly install its dependencies for your project:
your ``composer.json`` file:
.. code-block:: json .. code-block:: bash
"require-dev": { composer require --dev symfony/browser-kit symfony/css-selector
"symfony/browser-kit": ">=2.3,<2.4-dev",
"symfony/css-selector": ">=2.3,<2.4-dev"
}
For your WebTestCase, you will have to implement a ``createApplication`` For your WebTestCase, you will have to implement a ``createApplication``
method, which returns your application. It will probably look like this:: method, which returns your application. It will probably look like this::
......
...@@ -18,39 +18,11 @@ it, you should have the following directory structure: ...@@ -18,39 +18,11 @@ it, you should have the following directory structure:
└── web └── web
└── index.php └── index.php
If you want more flexibility, use Composer_ instead. Create a If you want more flexibility, use Composer_ instead:
``composer.json`` file and put this in it:
.. code-block:: json
{
"require": {
"silex/silex": "~1.1"
}
}
And run Composer to install Silex and all its dependencies:
.. code-block:: bash
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install
.. tip::
By default, Silex relies on the stable Symfony components. If you want to
use their master version instead, add ``"minimum-stability": "dev"`` in
your ``composer.json`` file.
Upgrading
---------
Upgrading Silex to the latest version is as easy as running the ``update``
command:
.. code-block:: bash .. code-block:: bash
$ php composer.phar update composer require silex/silex:~1.2
Bootstrap Bootstrap
--------- ---------
......
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