@@ -5,69 +5,46 @@ How to Install 3rd Party Bundles
55================================
66
77Most bundles provide their own installation instructions. However, the
8- basic steps for installing a bundle are the same.
8+ basic steps for installing a bundle are the same:
99
10- Add Composer Dependencies
11- -------------------------
10+ * `A) Add Composer Dependencies `_
11+ * `B) Enable the Bundle `_
12+ * `C) Configure the Bundle `_
1213
13- In Symfony, dependencies are managed with Composer. It's a good idea to learn
14- some basics of Composer in ` their documentation `_.
14+ A) Add Composer Dependencies
15+ ----------------------------
1516
16- Before you can use Composer to install a bundle, you should look for a
17- `Packagist `_ package of that bundle. For example, if you search for the popular
18- `FOSUserBundle `_ you will find a package called `friendsofsymfony/user-bundle `_.
17+ Dependencies are managed with Composer, so if Composer is new to you, learn
18+ some basics in `their documentation `_. This has 2 steps:
1919
20- .. note ::
21-
22- Packagist is the main archive for Composer. If you are searching
23- for a bundle, the best thing you can do is check out
24- `KnpBundles `_, it is the unofficial archive of Symfony Bundles. If
25- a bundle contains a ``README `` file, it is displayed there and if it
26- has a Packagist package it shows a link to the package. It's a
27- really useful site to begin searching for bundles.
20+ 1) Find out the Name of the Bundle on Packagist
21+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2822
29- Now that you have the package name, you should determine the version
30- you want to use. Usually different versions of a bundle correspond to
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.
23+ The README for a bundle (e.g. `FOSUserBundle `_) usually tells you its name
24+ (e.g. ``friendsofsymfony/user-bundle ``). If it doesn't, you can search for
25+ the library on the `Packagist.org `_ site.
3526
36- Now you can add the bundle to your ``composer.json `` file and update the
37- dependencies. You can do this manually:
38-
39- 1. **Add it to the ``composer.json`` file: **
27+ .. note ::
4028
41- .. code-block :: json
29+ Looking for bundles? Try searching at `KnpBundles.com `_: the unofficial
30+ archive of Symfony Bundles.
4231
43- {
44- ...,
45- "require" : {
46- ...,
47- "friendsofsymfony/user-bundle" : " 2.0.*@dev"
48- }
49- }
32+ 2) Install the Bundle via Composer
33+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5034
51- 2. ** Update the dependency: **
35+ Now that you know the package name, you can install it via Composer:
5236
5337 .. code-block :: bash
5438
55- $ php composer.phar update friendsofsymfony/user-bundle
56-
57- or update all dependencies
58-
59- .. code-block :: bash
39+ $ php composer.phar require friendsofsymfony/user-bundle
6040
61- $ php composer.phar update
41+ This will choose the best version for your project, add it to ``composer.json ``
42+ and download the library into the ``vendor/ `` directory. If you need a specific
43+ version, add a ``: `` and the version right after the library name (see
44+ `composer require `_).
6245
63- Or you can do this in one command:
64-
65- .. code-block :: bash
66-
67- $ php composer.phar require friendsofsymfony/user-bundle:2.0.* @dev
68-
69- Enable the Bundle
70- -----------------
46+ B) Enable the Bundle
47+ --------------------
7148
7249At this point, the bundle is installed in your Symfony project (in
7350``vendor/friendsofsymfony/ ``) and the autoloader recognizes its classes.
@@ -91,13 +68,13 @@ The only thing you need to do now is register the bundle in ``AppKernel``::
9168 }
9269 }
9370
94- Configure the Bundle
95- --------------------
71+ C) Configure the Bundle
72+ -----------------------
9673
97- Usually a bundle requires some configuration to be added to app's
98- ``app/config/config.yml `` file . The bundle's documentation will likely
99- describe that configuration. But you can also get a reference of the
100- bundle's config via the ``config:dump-reference `` command.
74+ It's pretty common for a bundle to need some additional setup or configuration
75+ in ``app/config/config.yml ``. The bundle's documentation will tell you about
76+ the configuration, but you can also get a reference of the bundle's config
77+ via the ``config:dump-reference `` command.
10178
10279For instance, in order to look the reference of the ``assetic `` config you
10380can use this:
@@ -132,10 +109,10 @@ Other Setup
132109-----------
133110
134111At this point, check the ``README `` file of your brand new bundle to see
135- what to do next.
112+ what to do next. Have fun!
136113
137114.. _their documentation : http://getcomposer.org/doc/00-intro.md
138- .. _Packagist : https://packagist.org
115+ .. _Packagist.org : https://packagist.org
139116.. _FOSUserBundle : https://github.com/FriendsOfSymfony/FOSUserBundle
140- .. _ `friendsofsymfony/user-bundle` : https ://packagist.org/packages/friendsofsymfony/user-bundle
141- .. _ KnpBundles : http ://knpbundles.com/
117+ .. _ KnpBundles.com : http ://knpbundles.com/
118+ .. _ `composer require` : https ://getcomposer.org/doc/03-cli.md#require
0 commit comments