Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1a7c4b9

Browse files
committed
Updating library/bundle installation docs to use the new composer require (no version) functionality
1 parent9591a04 commit1a7c4b9

File tree

4 files changed

+45
-95
lines changed

4 files changed

+45
-95
lines changed

‎components/dependency_injection/lazy_services.rst‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,19 @@ the `ProxyManager bridge`_:
3030

3131
..code-block::bash
3232
33-
$ php composer.phar require symfony/proxy-manager-bridge:2.3.*
33+
$ php composer.phar require symfony/proxy-manager-bridge
3434
3535
..note::
3636

3737
If you're using the full-stack framework, the proxy manager bridge is already
38-
included but the actual proxy manager needs to be included.Therefore add
38+
included but the actual proxy manager needs to be included.So, run:
3939

40-
..code-block::json
40+
..code-block::bash
4141
42-
"require": {
43-
"ocramius/proxy-manager":"0.4.*"
44-
}
42+
$ php composer.phar require ocramius/proxy-manager
4543
46-
to your ``composer.json``.Afterwards compile your container and check
47-
to make sure that you geta proxy for your lazy services.
44+
Afterwards compile your container and check to make sure that you get
45+
a proxy for your lazy services.
4846

4947
Configuration
5048
-------------

‎cookbook/bundles/best_practices.rst‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ following standardized instructions in your ``README.md`` file.
212212
following command to download the latest stable version of this bundle:
213213
214214
```bash
215-
$ composer require <package-name> "~1"
215+
$ composer require <package-name>
216216
```
217217
218218
This command requires you to have Composer installed globally, as explained
@@ -247,9 +247,6 @@ following standardized instructions in your ``README.md`` file.
247247
}
248248
```
249249
250-
This template assumes that your bundle is in its ``1.x`` version. If not, change
251-
the ``"~1"`` installation version accordingly (``"~2"``, ``"~3"``, etc.)
252-
253250
Optionally, you can add more installation steps (*Step 3*, *Step 4*, etc.) to
254251
explain other required installation tasks, such as registering routes or
255252
dumping assets.

‎cookbook/bundles/installation.rst‎

Lines changed: 35 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,46 @@ How to Install 3rd Party Bundles
55
================================
66

77
Most 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-
Starting from Symfony 2.1, dependencies are managed withComposer. It's
14-
a good idea to learn some basics of Composer in `their documentation`_.
14+
A) AddComposer 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.
28-
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.
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
42-
dependencies. You can do this manually:
43-
44-
1. **Add it to the ``composer.json`` file:**
45-
46-
..code-block::json
20+
1) Find out the Name of the Bundle on Packagist
21+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4722

48-
{
49-
...,
50-
"require": {
51-
...,
52-
"friendsofsymfony/user-bundle":"2.0.*@dev"
53-
}
54-
}
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.
5526

56-
2. **Update the dependency:**
27+
..note::
5728

58-
..code-block::bash
29+
Looking for bundles? Try searching at `KnpBundles.com`_: the unofficial
30+
archive of Symfony Bundles.
5931

60-
$ php composer.phar update friendsofsymfony/user-bundle
32+
2) Install the Bundle via Composer
33+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6134

62-
or update all dependencies
35+
Now that you know the package name, you can install it via Composer:
6336

6437
..code-block::bash
6538
66-
$ php composer.pharupdate
39+
$ php composer.pharrequire friendsofsymfony/user-bundle
6740
68-
Or you can do this in one command:
69-
70-
..code-block::bash
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`_).
7145

72-
$ php composer.phar require friendsofsymfony/user-bundle:2.0.*@dev
73-
74-
Enable the Bundle
75-
-----------------
46+
B) Enable the Bundle
47+
--------------------
7648

7749
At this point, the bundle is installed in your Symfony project (in
7850
``vendor/friendsofsymfony/``) and the autoloader recognizes its classes.
@@ -96,13 +68,13 @@ The only thing you need to do now is register the bundle in ``AppKernel``::
9668
}
9769
}
9870

99-
Configure the Bundle
100-
--------------------
71+
C)Configure the Bundle
72+
-----------------------
10173

102-
Usually a bundle requires some configuration tobe added to app's
103-
``app/config/config.yml`` file. The bundle's documentation willlikely
104-
describe thatconfiguration. But you can also get a reference of the
105-
bundle's configvia the ``config:dump-reference`` command.
74+
It's pretty common for a bundle toneed some additional setup or configuration
75+
in``app/config/config.yml``. The bundle's documentation willtell you about
76+
theconfiguration, but you can also get a reference of the bundle's config
77+
via the ``config:dump-reference`` command.
10678

10779
For instance, in order to look the reference of the ``assetic`` config you
10880
can use this:
@@ -137,10 +109,10 @@ Other Setup
137109
-----------
138110

139111
At this point, check the ``README`` file of your brand new bundle to see
140-
what to do next.
112+
what to do next. Have fun!
141113

142114
.. _their documentation:http://getcomposer.org/doc/00-intro.md
143-
.. _Packagist:https://packagist.org
115+
.. _Packagist.org:https://packagist.org
144116
.. _FOSUserBundle:https://github.com/FriendsOfSymfony/FOSUserBundle
145-
.. _`friendsofsymfony/user-bundle`:https://packagist.org/packages/friendsofsymfony/user-bundle
146117
.. _KnpBundles:http://knpbundles.com/
118+
.. _`composer require`:https://getcomposer.org/doc/03-cli.md#require

‎cookbook/workflow/_vendor_deps.rst.inc‎

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,12 @@ To upgrade your libraries to new versions, run ``php composer.phar update``.
2424

2525
.. tip::
2626

27-
If you want to add a new package to your application, modify the ``composer.json``
28-
file:
29-
30-
.. code-block:: json
31-
32-
{
33-
"require": {
34-
...
35-
"doctrine/doctrine-fixtures-bundle": "@dev"
36-
}
37-
}
38-
39-
and then execute the ``update`` command for this specific package, i.e.:
40-
41-
.. code-block:: bash
42-
43-
$ php composer.phar update doctrine/doctrine-fixtures-bundle
44-
45-
You can also combine both steps into a single command:
27+
If you want to add a new package to your application, run the composer
28+
``require`` command:
4629

4730
.. code-block:: bash
4831

49-
$ php composer.phar require doctrine/doctrine-fixtures-bundle:@dev
32+
$ php composer.phar require doctrine/doctrine-fixtures-bundle
5033

5134
To learn more about Composer, see `GetComposer.org`_:
5235

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp