Skip to content

Commit c4b754e

Browse files
committed
[symfony#2404] Tweaks to new bundle installation
1 parent 5e9452d commit c4b754e

File tree

3 files changed

+35
-29
lines changed

3 files changed

+35
-29
lines changed

cookbook/bundles/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Bundles
44
.. toctree::
55
:maxdepth: 2
66

7+
installation
78
best_practices
89
inheritance
910
override
1011
remove
1112
extension
12-
installation

cookbook/bundles/installation.rst

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
.. index::
22
single: Bundle; Installation
33

4-
How to install 3rd party bundles
4+
How to install 3rd party Bundles
55
================================
66

77
Most bundles provide their own installation instructions. However, the
88
basic steps for installing a bundle are the same.
99

10-
Add composer dependencies
10+
Add Composer Dependencies
1111
-------------------------
1212

13-
Starting from Symfony 2.1 dependencies are managed with Composer. It's
13+
Starting from Symfony 2.1, dependencies are managed with Composer. It's
1414
a good idea to learn some basics of Composer in `their documentation`_.
1515

1616
Before you can use composer to install a bundle, you should look for a
17-
`Packagist`_ package of that bundle. For example, for the
18-
`FOSUserBundle`_ you should look for a
19-
``friendsofsymfony/user-bundle`` package and it does exists:
20-
https://packagist.org/packages/friendsofsymfony/user-bundle .
17+
`Packagist`_ package of that bundle. For example, if you search for the popular
18+
`FOSUserBundle`_ you will find a packaged called `friendsofsymfony/user-bundle`_.
2119

2220
.. note::
2321

@@ -26,23 +24,24 @@ https://packagist.org/packages/friendsofsymfony/user-bundle .
2624
`KnpBundles`_, it is the unofficial achive of Symfony Bundles. If
2725
a bundle contains a ``README`` file, it is displayed there and if it
2826
has a Packagist package it shows a link to the package. It's a
29-
really usefull site to begin searching for bundles.
27+
really useful site to begin searching for bundles.
3028

3129
Now that you have the package name, you should determine the version
3230
you want to use. Usually different versions of a bundle correspond to
33-
a particular version of Symfony, this should be in the ``README`` file
34-
(in the Package, which you can view on Github or KnpBundles). If it
35-
isn't in the ``README``, you can use the version you want. In the case
36-
of the FOSUserBundle, the ``README`` file has a caution that version
37-
1.2.0 must be used for Symfony 2.0 and 1.3+ for Symfony
38-
2.1+. Packagist provides require statements for all existing
39-
versions. For the current development version it is now
40-
``"friendsofsymfony/user-bundle": "2.0.*@dev"``.
41-
42-
Now we can add the bundle to our ``composer.json`` file and update the
31+
a particular version of Symfony. This information should be in the ``README``
32+
file. If it isn't, you can use the version you want. If you choose an incompatible
33+
version, Composer will throw dependency errors when you try to install. If
34+
this happens, you can try a different version.
35+
36+
In the case of the FOSUserBundle, the ``README`` file has a caution that version
37+
1.2.0 must be used for Symfony 2.0 and 1.3+ for Symfony 2.1+. Packagist displays
38+
example ``require`` statements for all existing versions of a package. The
39+
current development version of FOSUserBundle is ``"friendsofsymfony/user-bundle": "2.0.*@dev"``.
40+
41+
Now you can add the bundle to your ``composer.json`` file and update the
4342
dependencies. You can do this manually:
4443

45-
1. **Add it to the ``composer.json`` file:**
44+
1. **Add it to the composer.json file:**
4645

4746
.. code-block:: json
4847
@@ -72,13 +71,12 @@ Or you can do this in one command:
7271
7372
$ php composer.phar require friendsofsymfony/user-bundle:2.0.*@dev
7473
75-
Enable the bundle
74+
Enable the Bundle
7675
-----------------
7776

78-
Now the bundle is installed into our Symfony project (in
79-
``vendor/friendsofsymfony/``) and the autoloader recognizes this
80-
bundle. The only thing we need to do now is registering the bundle in
81-
the ``AppKernel``::
77+
At this point, the bundle is installed in your Symfony project (in
78+
``vendor/friendsofsymfony/``) and the autoloader recognizes its classes.
79+
The only thing you need to do now is register the bundle in ``AppKernel``::
8280

8381
// app/AppKernel.php
8482

@@ -98,15 +96,15 @@ the ``AppKernel``::
9896
}
9997
}
10098

101-
Configure the bundle
99+
Configure the Bundle
102100
--------------------
103101

104-
Usually bundles require some configuration to be added to app's
102+
Usually a bundle requires some configuration to be added to app's
105103
``app/config/config.yml`` file. The bundle's documentation will likely
106104
describe that configuration. But you can also get a reference of the
107-
bundle's config via ``config:dump-reference`` command.
105+
bundle's config via the ``config:dump-reference`` command.
108106

109-
For instance, in order to look the reference of the assetic config we
107+
For instance, in order to look the reference of the ``assetic`` config you
110108
can use this:
111109

112110
.. code-block:: bash
@@ -135,7 +133,14 @@ The output will look like this:
135133
node_paths: []
136134
# ...
137135
136+
Other Setup
137+
-----------
138+
139+
At this point, check the ``README`` file of your brand new bundle to see
140+
what do to next.
141+
138142
.. _their documentation: http://getcomposer.org/doc/00-intro.md
139143
.. _Packagist: https://packagist.org
140144
.. _FOSUserBundle: https://github.com/FriendsOfSymfony/FOSUserBundle
145+
.. _`friendsofsymfony/user-bundle`: https://packagist.org/packages/friendsofsymfony/user-bundle
141146
.. _KnpBundles: http://knpbundles.com/

cookbook/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
* :doc:`/cookbook/bundles/index`
99

10+
* :doc:`/cookbook/bundles/installation`
1011
* :doc:`/cookbook/bundles/best_practices`
1112
* :doc:`/cookbook/bundles/inheritance`
1213
* :doc:`/cookbook/bundles/override`

0 commit comments

Comments
 (0)