1
1
.. index ::
2
2
single: Bundle; Installation
3
3
4
- How to install 3rd party bundles
4
+ How to install 3rd party Bundles
5
5
================================
6
6
7
7
Most bundles provide their own installation instructions. However, the
8
8
basic steps for installing a bundle are the same.
9
9
10
- Add composer dependencies
10
+ Add Composer Dependencies
11
11
-------------------------
12
12
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
14
14
a good idea to learn some basics of Composer in `their documentation `_.
15
15
16
16
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 `_.
21
19
22
20
.. note ::
23
21
@@ -26,23 +24,24 @@ https://packagist.org/packages/friendsofsymfony/user-bundle .
26
24
`KnpBundles `_, it is the unofficial achive of Symfony Bundles. If
27
25
a bundle contains a ``README `` file, it is displayed there and if it
28
26
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.
30
28
31
29
Now that you have the package name, you should determine the version
32
30
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
43
42
dependencies. You can do this manually:
44
43
45
- 1. **Add it to the `` composer.json`` file: **
44
+ 1. **Add it to the composer.json file: **
46
45
47
46
.. code-block :: json
48
47
@@ -72,13 +71,12 @@ Or you can do this in one command:
72
71
73
72
$ php composer.phar require friendsofsymfony/user-bundle:2.0.* @dev
74
73
75
- Enable the bundle
74
+ Enable the Bundle
76
75
-----------------
77
76
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 ``::
82
80
83
81
// app/AppKernel.php
84
82
@@ -98,15 +96,15 @@ the ``AppKernel``::
98
96
}
99
97
}
100
98
101
- Configure the bundle
99
+ Configure the Bundle
102
100
--------------------
103
101
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
105
103
``app/config/config.yml `` file. The bundle's documentation will likely
106
104
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.
108
106
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
110
108
can use this:
111
109
112
110
.. code-block :: bash
@@ -135,7 +133,14 @@ The output will look like this:
135
133
node_paths: []
136
134
# ...
137
135
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
+
138
142
.. _their documentation : http://getcomposer.org/doc/00-intro.md
139
143
.. _Packagist : https://packagist.org
140
144
.. _FOSUserBundle : https://github.com/FriendsOfSymfony/FOSUserBundle
145
+ .. _`friendsofsymfony/user-bundle` : https://packagist.org/packages/friendsofsymfony/user-bundle
141
146
.. _KnpBundles : http://knpbundles.com/
0 commit comments