Skip to content

Commit 55a32cf

Browse files
committed
feature #4173 use a global Composer installation (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- use a global Composer installation | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | #4170 This pull request replaces all mentions of local Composer installations, but uses a gobal Composer installation instead. **Note:** This should be considered on hold and not be merged until we have an agreement on this in #4170. Commits ------- 9ab1c56 use a global Composer installation
2 parents 0db36ea + 9ab1c56 commit 55a32cf

File tree

14 files changed

+83
-62
lines changed

14 files changed

+83
-62
lines changed

book/from_flat_php_to_symfony2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ into a vendor/ directory:
447447

448448
.. code-block:: bash
449449
450-
$ php composer.phar install
450+
$ composer install
451451
452452
Beside downloading your dependencies, Composer generates a ``vendor/autoload.php`` file,
453453
which takes care of autoloading for all the files in the Symfony Framework as well as

book/installation.rst

+1-10
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,7 @@ don't have installed it globally, start by reading the next section.
117117
Installing Composer Globally
118118
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
119119

120-
On Linux and Mac OS X, execute the following two commands to install Composer
121-
globally:
122-
123-
.. code-block:: bash
124-
125-
$ curl -sS https://getcomposer.org/installer | php
126-
$ sudo mv composer.phar /usr/local/bin/composer
127-
128-
On Windows Systems, download the executable Composer installer that you can find
129-
on the `Composer download page`_ and follow the steps.
120+
Start with :doc:`installing Composer globally </cookbook/composer>`.
130121

131122
Creating a Symfony Application with Composer
132123
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

book/performance.rst

+2-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ command line, and might become part of your deploy process:
6060

6161
.. code-block:: bash
6262
63-
$ php composer.phar dump-autoload --optimize
63+
$ composer dump-autoload --optimize
6464
6565
Internally, this builds the big class map array in ``vendor/composer/autoload_classmap.php``.
6666

@@ -128,8 +128,7 @@ Note that there are two disadvantages when using a bootstrap file:
128128
* when debugging, one will need to place break points inside the bootstrap file.
129129

130130
If you're using the Symfony Standard Edition, the bootstrap file is automatically
131-
rebuilt after updating the vendor libraries via the ``php composer.phar install``
132-
command.
131+
rebuilt after updating the vendor libraries via the ``composer install`` command.
133132

134133
Bootstrap Files and Byte Code Caches
135134
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

components/dependency_injection/lazy_services.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ the `ProxyManager bridge`_:
3030

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

components/intl.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ code::
8585
the server.
8686

8787
For example, consider that your development machines ship ICU 4.8 and the server
88-
ICU 4.2. When you run ``php composer.phar update`` on the development machine, version
88+
ICU 4.2. When you run ``composer update`` on the development machine, version
8989
1.2.* of the Icu component will be installed. But after deploying the
90-
application, ``php composer.phar install`` will fail with the following error:
90+
application, ``composer install`` will fail with the following error:
9191

9292
.. code-block:: bash
9393
94-
$ php composer.phar install
94+
$ composer install
9595
Loading composer repositories with package information
9696
Installing dependencies from lock file
9797
Your requirements could not be resolved to an installable set of packages.
@@ -104,8 +104,8 @@ code::
104104
The error tells you that the requested version of the Icu component, version
105105
1.2, is not compatible with PHP's ICU version 4.2.
106106

107-
One solution to this problem is to run ``php composer.phar update`` instead of
108-
``php composer.phar install``. It is highly recommended **not** to do this. The
107+
One solution to this problem is to run ``composer update`` instead of
108+
``composer install``. It is highly recommended **not** to do this. The
109109
``update`` command will install the latest versions of each Composer dependency
110110
to your production server and potentially break the application.
111111

@@ -130,7 +130,7 @@ code::
130130
* "1.0.*" if the server does not have the intl extension installed;
131131
* "1.1.*" if the server is compiled with ICU 4.2 or lower.
132132

133-
Finally, run ``php composer.phar update symfony/icu`` on your development machine, test
133+
Finally, run ``composer update symfony/icu`` on your development machine, test
134134
extensively and deploy again. The installation of the dependencies will now
135135
succeed.
136136

components/using_components.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ whatever component you want.
3131

3232
.. tip::
3333

34-
If you get a command not found for ``composer``, you'll need to
35-
`Install composer`_. Depending on how you install, you may end up with
36-
a ``composer.phar`` file in your directory. In that case, no worries!
37-
Just run ``php composer.phar require symfony/finder``.
34+
`Install composer`_ if you don't have it already present on your system.
35+
Depending on how you install, you may end up with a ``composer.phar``
36+
file in your directory. In that case, no worries! Just run
37+
``php composer.phar require symfony/finder``.
3838

3939
If you know you need a specific version of the library, add that to the command:
4040

4141
.. code-block:: bash
4242
43-
$ composer require symfony/finder:~2.3
43+
$ composer require symfony/finder
4444
4545
**3.** Write your code!
4646

contributing/code/tests.rst

+4-22
Original file line numberDiff line numberDiff line change
@@ -28,42 +28,24 @@ The test suite needs the following third-party libraries:
2828

2929
To install them all, use `Composer`_:
3030

31-
Step 1: Get `Composer`_
31+
Step 1: :doc:`Install Composer globally </cookbook/composer>`
3232

33-
.. code-block:: bash
34-
35-
$ curl -s http://getcomposer.org/installer | php
36-
37-
Make sure you download ``composer.phar`` in the same folder where
38-
the ``composer.json`` file is located.
39-
40-
Step 2: Install vendors
33+
Step 2: Install vendors.
4134

4235
.. code-block:: bash
4336
44-
$ php composer.phar install
37+
$ composer install
4538
4639
.. note::
4740

4841
Note that the script takes some time to finish.
4942

50-
.. note::
51-
52-
If you don't have ``curl`` installed, you can also just download the ``installer``
53-
file manually at http://getcomposer.org/installer. Place this file into your
54-
project and then run:
55-
56-
.. code-block:: bash
57-
58-
$ php installer
59-
$ php composer.phar install
60-
6143
After installation, you can update the vendors to their latest version with
6244
the follow command:
6345

6446
.. code-block:: bash
6547
66-
$ php composer.phar update
48+
$ composer --dev update
6749
6850
Running
6951
-------

cookbook/bundles/installation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Now that you know the package name, you can install it via Composer:
3636

3737
.. code-block:: bash
3838
39-
$ php composer.phar require friendsofsymfony/user-bundle
39+
$ composer require friendsofsymfony/user-bundle
4040
4141
This will choose the best version for your project, add it to ``composer.json``
4242
and download the library into the ``vendor/`` directory. If you need a specific

cookbook/composer.rst

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.. index::
2+
double: Composer; Installation
3+
4+
Installing Composer
5+
===================
6+
7+
`Composer`_ is the package manager used by modern PHP applications and the
8+
recommended way to install Symfony2.
9+
10+
Install Composer on Linux and Mac OS X
11+
--------------------------------------
12+
13+
To install Composer on Linux or Mac OS X, execute the following two commands:
14+
15+
.. code-block:: bash
16+
17+
$ curl -sS https://getcomposer.org/installer | php
18+
$ sudo mv composer.phar /usr/local/bin/composer
19+
20+
-.. note::
21+
22+
If you don't have ``curl`` installed, you can also just download the
23+
``installer`` file manually at http://getcomposer.org/installer and
24+
then run:
25+
26+
.. code-block:: bash
27+
28+
$ php installer
29+
$ sudo mv composer.phar /usr/local/bin/composer
30+
31+
Install Composer on Windows
32+
---------------------------
33+
34+
Download the installer from `getcomposer.org/download`_, execute it and follow
35+
the instructions.
36+
37+
Learn more
38+
----------
39+
40+
You can read more about Composer in `its documentation`_.
41+
42+
.. _`Composer`: https://getcomposer.org/
43+
.. _`getcomposer.org/download`: https://getcomposer.org/download
44+
.. _`its documentation`: https://getcomposer.org/doc/00-intro.md

cookbook/deployment/tools.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ as you normally do:
101101

102102
.. code-block:: bash
103103
104-
$ php composer.phar install --no-dev --optimize-autoloader
104+
$ composer install --no-dev --optimize-autoloader
105105
106106
.. tip::
107107

@@ -142,7 +142,7 @@ setup:
142142

143143
* Running any database migrations
144144
* Clearing your APC cache
145-
* Running ``assets:install`` (taken care of already in ``composer.phar install``)
145+
* Running ``assets:install`` (already taken care of in ``composer install``)
146146
* Add/edit CRON jobs
147147
* Pushing assets to a CDN
148148
* ...

cookbook/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The Cookbook
77
assetic/index
88
bundles/index
99
cache/index
10+
composer
1011
configuration/index
1112
console/index
1213
controller/index

cookbook/map.rst.inc

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
* :doc:`/cookbook/cache/varnish`
2323

24+
* **Composer**
25+
26+
* :doc:`/cookbook/composer`
27+
2428
* :doc:`/cookbook/configuration/index`
2529

2630
* :doc:`/cookbook/configuration/environments`

cookbook/symfony1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ defined in the ``composer.json`` file.
165165
If you look at the ``HelloController`` from the Symfony2 Standard Edition you
166166
can see that it lives in the ``Acme\DemoBundle\Controller`` namespace. Yet, the
167167
AcmeDemoBundle is not defined in your ``composer.json`` file. Nonetheless are
168-
the files autoloaded. This is because you can tell composer to autoload files
168+
the files autoloaded. This is because you can tell Composer to autoload files
169169
from specific directories without defining a dependency:
170170

171171
.. code-block:: json

cookbook/workflow/_vendor_deps.rst.inc

+10-10
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ way or another the goal is to download these files into your ``vendor/``
99
directory and, ideally, to give you some sane way to manage the exact version
1010
you need for each.
1111

12-
By default, these libraries are downloaded by running a ``php composer.phar install``
13-
"downloader" binary. This ``composer.phar`` file is from a library called
14-
`Composer`_ and you can read more about installing it in the :ref:`Installation <installation-updating-vendors>`
12+
By default, these libraries are downloaded by running a ``composer install``
13+
"downloader" binary. This ``composer`` file is from a library called `Composer`_
14+
and you can read more about installing it in the :ref:`Installation <installation-updating-vendors>`
1515
chapter.
1616

17-
The ``composer.phar`` file reads from the ``composer.json`` file at the root
17+
The ``composer`` command reads from the ``composer.json`` file at the root
1818
of your project. This is an JSON-formatted file, which holds a list of each
1919
of the external packages you need, the version to be downloaded and more.
20-
The ``composer.phar`` file also reads from a ``composer.lock`` file, which
21-
allows you to pin each library to an **exact** version. In fact, if a ``composer.lock``
20+
``composer`` also reads from a ``composer.lock`` file, which allows you to
21+
pin each library to an **exact** version. In fact, if a ``composer.lock``
2222
file exists, the versions inside will override those in ``composer.json``.
23-
To upgrade your libraries to new versions, run ``php composer.phar update``.
23+
To upgrade your libraries to new versions, run ``composer update``.
2424

2525
.. tip::
2626

@@ -29,20 +29,20 @@ To upgrade your libraries to new versions, run ``php composer.phar update``.
2929

3030
.. code-block:: bash
3131

32-
$ php composer.phar require doctrine/doctrine-fixtures-bundle
32+
$ composer require doctrine/doctrine-fixtures-bundle
3333

3434
To learn more about Composer, see `GetComposer.org`_:
3535

3636
It's important to realize that these vendor libraries are *not* actually part
3737
of *your* repository. Instead, they're simply un-tracked files that are downloaded
3838
into the ``vendor/``. But since all the information needed to download these
3939
files is saved in ``composer.json`` and ``composer.lock`` (which *are* stored
40-
in the repository), any other developer can use the project, run ``php composer.phar install``,
40+
in the repository), any other developer can use the project, run ``composer install``,
4141
and download the exact same set of vendor libraries. This means that you're
4242
controlling exactly what each vendor library looks like, without needing to
4343
actually commit them to *your* repository.
4444
45-
So, whenever a developer uses your project, they should run the ``php composer.phar install``
45+
So, whenever a developer uses your project, they should run the ``composer install``
4646
script to ensure that all of the needed vendor libraries are downloaded.
4747
4848
.. sidebar:: Upgrading Symfony

0 commit comments

Comments
 (0)