Commit 0634a382 authored by Fabien Potencier's avatar Fabien Potencier

Merge branch '1.2'

* 1.2:
  Fixed Form Provider documentation
  Fix: Add missing method visibility in interface excerpts
  Adding a default port for the connection to the database
  Simplify installation instructions
  simplified Composer instructions

Conflicts:
	README.rst
	doc/providers.rst
	doc/usage.rst
parents 041d7955 b0edcc39
......@@ -23,17 +23,11 @@ Silex works with PHP 5.3.3 or later.
Installation
------------
The recommended way to install Silex is through `Composer`_. Just create a
``composer.json`` file and run the ``php composer.phar install`` command to
install it:
The recommended way to install Silex is through `Composer`_:
.. code-block:: json
.. code-block:: bash
{
"require": {
"silex/silex": "~1.2"
}
}
php composer.phar require silex/silex "~2.0@dev"
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
use YAML files for validation. But this doesn't mean that this is not
possible. Let's see how to do it.
First, you need to install the YAML Component. Declare it as a dependency in
your ``composer.json`` file:
First, you need to install the YAML Component:
.. code-block:: json
.. code-block:: bash
"require": {
"symfony/yaml": "~2.3"
}
composer require symfony/yaml
Next, you need to tell the Validation Service that you are not using
``StaticMethodLoader`` to load your class metadata but a YAML file::
......
......@@ -84,7 +84,7 @@ Providers must implement the ``Pimple\ServiceProviderInterface``::
interface ServiceProviderInterface
{
function register(Container $container);
public function register(Container $container);
}
This is very straight forward, just create a new class that implements the
......@@ -201,7 +201,7 @@ Providers must implement the ``Silex\Api\ControllerProviderInterface``::
interface ControllerProviderInterface
{
function connect(Application $app);
public function connect(Application $app);
}
Here is an example of such a provider::
......
......@@ -67,14 +67,11 @@ Registering
.. note::
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
``composer.json`` file:
one. If you are using Composer, add it as a dependency:
.. code-block:: json
.. code-block:: bash
"require": {
"doctrine/dbal": "2.2.*",
}
composer require "doctrine/dbal:~2.2"
Usage
-----
......
......@@ -52,54 +52,34 @@ Registering
.. note::
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
``composer.json`` file:
.. code-block:: bash
.. code-block:: json
"require": {
"symfony/form": "~2.3"
}
composer require symfony/form
If you are going to use the validation extension with forms, you must also
add a dependency to the ``symfony/config`` and ``symfony/translation``
components:
.. code-block:: json
"require": {
"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
it, you can install the Symfony Locale Component as a replacement:
.. code-block:: bash
.. code-block:: json
"require": {
"symfony/locale": "~2.3"
}
composer require symfony/validator symfony/config symfony/translation
The Symfony Security CSRF component is used to protect forms against CSRF attacks:
.. code-block:: json
.. code-block:: bash
"require": {
"symfony/security-csrf": "~2.4"
}
composer require symfony/security-csrf
If you want to use forms in your Twig templates, make sure to install the
Symfony Twig Bridge:
If you want to use forms in your Twig templates, you can also install the
Symfony Twig Bridge. Make sure to install, if you didn't do that already,
the Translation component in order for the bridge to work:
.. code-block:: json
.. code-block:: bash
"require": {
"symfony/twig-bridge": "~2.3"
}
composer require symfony/twig-bridge symfony/translation
Usage
-----
......
......@@ -54,14 +54,11 @@ Registering
.. note::
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
``composer.json`` file:
If you are using Composer, add it as a dependency:
.. code-block:: json
.. code-block:: bash
"require": {
"monolog/monolog": ">=1.0.0"
}
composer require monolog/monolog
Usage
-----
......
......@@ -55,14 +55,11 @@ Registering
.. note::
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
your ``composer.json`` file:
with the regular one. If you are using Composer, add it as a dependency:
.. code-block:: json
.. code-block:: bash
"require": {
"symfony/security": "~2.3"
}
composer require symfony/security
.. caution::
......
......@@ -36,14 +36,11 @@ Registering
The *SerializerServiceProvider* relies on Symfony's `Serializer Component
<http://symfony.com/doc/current/components/serializer.html>`_,
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
``composer.json`` file:
one. If you are using Composer, add it as a dependency:
.. code-block:: json
.. code-block:: bash
"require": {
"symfony/serializer": ">=2.3,<2.5-dev",
}
composer require symfony/serializer
Usage
-----
......
......@@ -71,14 +71,11 @@ Registering
.. note::
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
``composer.json`` file:
one. If you are using Composer, add it as a dependency:
.. code-block:: json
.. code-block:: bash
"require": {
"swiftmailer/swiftmailer": ">=4.1.2,<4.2-dev"
}
composer require swiftmailer/swiftmailer
Usage
-----
......
......@@ -46,13 +46,11 @@ Registering
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
dependency to your ``composer.json`` file:
dependency:
.. code-block:: json
.. code-block:: bash
"require": {
"symfony/translation": "~2.3"
}
composer require symfony/translation
Usage
-----
......@@ -121,15 +119,11 @@ YAML-based language files
Having your translations in PHP files can be inconvenient. This recipe will
show you how to load translations from external YAML files.
First, add the Symfony2 ``Config`` and ``Yaml`` components in your composer
file:
First, add the Symfony2 ``Config`` and ``Yaml`` components as dependencies:
.. code-block:: json
.. code-block:: bash
"require": {
"symfony/config": "~2.3",
"symfony/yaml": "~2.3"
}
composer require symfony/config symfony/yaml
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:
......
......@@ -42,27 +42,21 @@ Registering
.. note::
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``
file:
you are using Composer, add it as a dependency:
.. code-block:: json
.. code-block:: bash
"require": {
"twig/twig": ">=1.8,<2.0-dev"
}
composer require twig/twig
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:
some Symfony2 components and Twig. Add it as a dependency:
.. code-block:: json
.. code-block:: bash
"require": {
"symfony/twig-bridge": "~2.3"
}
composer require symfony/twig-bridge
When present, the ``TwigServiceProvider`` will provide you with the following
additional capabilities:
......
......@@ -54,8 +54,8 @@ When using Twig, the service can be used like this:
{{ app.url_generator.generate('homepage') }}
Moreover, if you have ``twig-bridge`` in your ``composer.json``, you will have access to the ``path()`` and
``url()`` functions:
Moreover, if you have ``twig-bridge`` as a Composer dep, you will have access
to the ``path()`` and ``url()`` functions:
.. code-block:: jinja
......
......@@ -38,14 +38,11 @@ Registering
.. note::
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
your ``composer.json`` file:
with the regular one. If you are using Composer, add it as a dependency:
.. code-block:: json
.. code-block:: bash
"require": {
"symfony/validator": "~2.3"
}
composer require symfony/validator
Usage
-----
......
......@@ -79,15 +79,11 @@ use it by making your test extend it::
.. note::
If you want to use the Symfony2 ``WebTestCase`` class you will need to
explicitly install its dependencies for your project. Add the following to
your ``composer.json`` file:
explicitly install its dependencies for your project:
.. code-block:: json
.. code-block:: bash
"require-dev": {
"symfony/browser-kit": ">=2.3,<2.4-dev",
"symfony/css-selector": ">=2.3,<2.4-dev"
}
composer require --dev symfony/browser-kit symfony/css-selector
For your WebTestCase, you will have to implement a ``createApplication``
method, which returns your application. It will probably look like this::
......
......@@ -18,39 +18,11 @@ it, you should have the following directory structure:
└── web
└── index.php
If you want more flexibility, use Composer_ instead. Create a
``composer.json`` file and put this in it:
.. code-block:: json
{
"require": {
"silex/silex": "~2.0"
}
}
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:
If you want more flexibility, use Composer_ instead:
.. code-block:: bash
$ php composer.phar update
composer require silex/silex:~2.0
Bootstrap
---------
......
......@@ -33,7 +33,7 @@ class DoctrineServiceProvider implements ServiceProviderInterface
'host' => 'localhost',
'user' => 'root',
'password' => null,
'port' => null,
'port' => 3306,
);
$app['dbs.options.initializer'] = $app->protect(function () use ($app) {
......
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