Skip to content

Commit 5665e71

Browse files
committed
use a global Composer installation
1 parent c8f96c0 commit 5665e71

15 files changed

+75
-94
lines changed

book/from_flat_php_to_symfony2.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,13 @@ Option 1) Composer
4141
`Composer`_ is a dependency management library for PHP, which you can use
4242
to download the Symfony Standard Edition.
4343

44-
Start by `downloading Composer`_ anywhere onto your local computer. If you
45-
have curl installed, it's as easy as:
44+
Start by :doc:`installing Composer globally </cookbook/composer>` onto your
45+
local computer. Composer is an executable PHAR file, which you can use to
46+
download the Standard Distribution:
4647

4748
.. code-block:: bash
4849
49-
$ curl -s https://getcomposer.org/installer | php
50-
51-
.. note::
52-
53-
If your computer is not ready to use Composer, you'll see some recommendations
54-
when running this command. Follow those recommendations to get Composer
55-
working properly.
56-
57-
Composer is an executable PHAR file, which you can use to download the Standard
58-
Distribution:
59-
60-
.. code-block:: bash
61-
62-
$ php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony '2.3.*'
50+
$ composer create-project symfony/framework-standard-edition /path/to/webroot/Symfony '2.3.*'
6351
6452
.. tip::
6553

@@ -150,42 +138,23 @@ Depending on how you downloaded Symfony, you may or may not need to update
150138
your vendors right now. But, updating your vendors is always safe, and guarantees
151139
that you have all the vendor libraries you need.
152140

153-
Step 1: Get `Composer`_ (The great new PHP packaging system)
154-
155-
.. code-block:: bash
156-
157-
$ curl -s http://getcomposer.org/installer | php
158-
159-
Make sure you download ``composer.phar`` in the same folder where
160-
the ``composer.json`` file is located (this is your Symfony project
161-
root by default).
141+
Step 1: :doc:`Globally install Composer </cookbook/composer>` (the great new
142+
PHP packaging system)
162143

163144
Step 2: Install vendors
164145

165146
.. code-block:: bash
166147
167-
$ php composer.phar install
148+
$ composer install
168149
169150
This command downloads all of the necessary vendor libraries - including
170151
Symfony itself - into the ``vendor/`` directory.
171152

172-
.. note::
173-
174-
If you don't have ``curl`` installed, you can also just download the ``installer``
175-
file manually at http://getcomposer.org/installer. Place this file into your
176-
project and then run:
177-
178-
.. code-block:: bash
179-
180-
$ php installer
181-
$ php composer.phar install
182-
183153
.. tip::
184154

185-
When running ``php composer.phar install`` or ``php composer.phar update``,
186-
Composer will execute post install/update commands to clear the cache
187-
and install assets. By default, the assets will be copied into your ``web``
188-
directory.
155+
When running ``composer install`` or ``composer update``, Composer will
156+
execute post install/update commands to clear the cache and install assets.
157+
By default, the assets will be copied into your ``web`` directory.
189158

190159
Instead of copying your Symfony assets, you can create symlinks if
191160
your operating system supports it. To create symlinks, add an entry
@@ -357,15 +326,14 @@ file:
357326
358327
Now, the vendor directory won't be committed to source control. This is fine
359328
(actually, it's great!) because when someone else clones or checks out the
360-
project, they can simply run the ``php composer.phar install`` script to
361-
install all the necessary project dependencies.
329+
project, they can simply run the ``composer install`` script to install all
330+
the necessary project dependencies.
362331

363332
.. _`enable ACL support`: https://help.ubuntu.com/community/FilePermissionsACLs
364333
.. _`http://symfony.com/download`: http://symfony.com/download
365334
.. _`Git`: http://git-scm.com/
366335
.. _`GitHub Bootcamp`: http://help.github.com/set-up-git-redirect
367336
.. _`Composer`: http://getcomposer.org/
368-
.. _`downloading Composer`: http://getcomposer.org/download/
369337
.. _`Apache`: http://httpd.apache.org/docs/current/mod/core.html#documentroot
370338
.. _`Nginx`: http://wiki.nginx.org/Symfony
371339
.. _`Symfony Installation Page`: http://symfony.com/download

book/performance.rst

Lines changed: 2 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ may also need to adjust the version (e.g. ``2.2.2`` or ``2.3.*``).
3535

3636
You can research the component names and versions at `packagist.org`_.
3737

38-
**3.** `Install composer`_ if you don't already have it present on your system:
38+
**3.** `Install composer`_ if you don't have it already present on your system.
3939

4040
**4.** Download the vendor libraries and generate the ``vendor/autoload.php`` file:
4141

4242
.. code-block:: bash
4343
44-
$ php composer.phar install
44+
$ composer install
4545
4646
**5.** Write your code:
4747

contributing/code/tests.rst

Lines changed: 4 additions & 22 deletions
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 --dev 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 --dev 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 --dev update
48+
$ composer --dev update
6749
6850
Running
6951
-------

cookbook/bundles/installation.rst

Lines changed: 1 addition & 1 deletion
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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
Install Composer on Windows
21+
---------------------------
22+
23+
Download the installer from `getcomposer.org/download`_, execute it and follow
24+
the instructions.
25+
26+
.. _`Composer`: https://getcomposer.org/
27+
.. _`getcomposer.org/download`: https://getcomposer.org/download

cookbook/deployment/tools.rst

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 10 additions & 10 deletions
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

cookbook/workflow/new_project_git.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ git repository:
2626

2727
.. code-block:: bash
2828
29-
$ php composer.phar create-project symfony/framework-standard-edition path/ '~2.5'
29+
$ composer create-project symfony/framework-standard-edition path/ '~2.3'
3030
3131
.. tip::
3232

0 commit comments

Comments
 (0)