1
- Managing Vendor Libraries with bin/vendors and deps
2
- ---------------------------------------------------
1
+ Managing Vendor Libraries with composer.json
2
+ --------------------------------------------
3
3
4
4
### How does it work ?
5
5
@@ -8,80 +8,43 @@ way or another the goal is to download these files into your ``vendor/``
8
8
directory and, ideally, to give you some sane way to manage the exact version
9
9
you need for each.
10
10
11
- By default, these libraries are downloaded by running a ``php bin/vendors install``
12
- "downloader" script. This script reads from the ``deps`` file at the root
13
- of your project. This is an ini-formatted script, which holds a list of each
14
- of the external libraries you need, the directory each should be downloaded to,
15
- and (optionally) the version to be downloaded. The ``bin/vendors`` script
16
- uses ``git`` to downloaded these, solely because these external libraries
17
- themselves tend to be stored via git. The ``bin/vendors`` script also reads
18
- the ``deps.lock`` file, which allows you to pin each library to an exact
19
- git commit hash.
11
+ By default, these libraries are downloaded by running a ``php composer.phar install``
12
+ "downloader" binary. This ``composer.phar`` file is from a library called
13
+ `Composer`_ and you can read more about installing it in the :ref:`Installation<installation-updating-vendors>`
14
+ chapter.
15
+
16
+ The ``composer.phar`` file reads from the ``composer.json`` file at the root
17
+ of your project. This is an JSON-formatted file, which holds a list of each
18
+ of the external packages you need, the version to be downloaded and more.
19
+ The ``composer.phar`` file also reads from a ``composer.lock`` file, which
20
+ allows you to pin each library to an **exact** version. In fact, if a ``composer.lock``
21
+ file exists, the versions inside will override those in ``composer.json``.
22
+ To upgrade your libraries to new versions, run ``php composer.phar update``.
23
+
24
+ To learn more about Composer, see `GetComposer.org`_:
20
25
21
26
It's important to realize that these vendor libraries are *not* actually part
22
27
of *your* repository. Instead, they're simply un-tracked files that are downloaded
23
- into the ``vendor/`` directory by the ``bin/vendors`` script. But since all
24
- the information needed to download these files is saved in ``deps`` and ``deps.lock``
25
- (which *are* stored) in our repository), any other developer can use our
26
- project, run ``php bin/vendors install``, and download the exact same set
27
- of vendor libraries. This means that you're controlling exactly what each
28
- vendor library looks like, without needing to actually commit them to *your*
29
- repository.
30
-
31
- So, whenever a developer uses your project, he/she should run the ``php bin/vendors install``
28
+ into the ``vendor/``. But since all the information needed to download these
29
+ files is saved in ``composer.json`` and ``composer.lock`` (which *are* stored)
30
+ in our repository, any other developer can use our project, run ``php composer.phar install``,
31
+ and download the exact same set of vendor libraries. This means that you're
32
+ controlling exactly what each vendor library looks like, without needing to
33
+ actually commit them to *your* repository.
34
+
35
+ So, whenever a developer uses your project, he/she should run the ``php composer.phar install``
32
36
script to ensure that all of the needed vendor libraries are downloaded.
33
37
34
38
.. sidebar:: Upgrading Symfony
35
39
36
40
Since Symfony is just a group of third-party libraries and third-party
37
- libraries are entirely controlled through ``deps `` and ``deps .lock``,
41
+ libraries are entirely controlled through ``composer.json `` and ``composer .lock``,
38
42
upgrading Symfony means simply upgrading each of these files to match
39
43
their state in the latest Symfony Standard Edition.
40
44
41
- Of course, if you've added new entries to ``deps`` or ``deps.lock ``, be sure
45
+ Of course, if you've added new entries to ``composer.json ``, be sure
42
46
to replace only the original parts (i.e. be sure not to also delete any of
43
47
your custom entries).
44
48
45
- .. caution::
46
-
47
- There is also a ``php bin/vendors update`` command, but this has nothing
48
- to do with upgrading your project and you will normally not need to use
49
- it. This command is used to freeze the versions of all of your vendor libraries
50
- by updating them to the version specified in ``deps`` and recording it
51
- into the ``deps.lock`` file.
52
-
53
- ### Hacking vendor libraries
54
-
55
- Sometimes, you want a specific branch, tag, or commit of a library to be downloaded
56
- or upgraded. You can set that directly to the ``deps`` file :
57
-
58
- .. code-block:: text
59
-
60
- [AcmeAwesomeBundle]
61
- git=http://github.com/johndoe/Acme/AwesomeBundle.git
62
- target=/bundles/Acme/AwesomeBundle
63
- version=the-awesome-version
64
-
65
- * The ``git`` option sets the URL of the library. It can use various protocols,
66
- like ``http://`` as well as ``git://``.
67
-
68
- * The ``target`` option specifies where the repository will live : plain Symfony
69
- bundles should go under the ``vendor/bundles/Acme`` directory, other third-party
70
- libraries usually go to ``vendor/my-awesome-library-name``. The target directory
71
- defaults to this last option when not specified.
72
-
73
- * The ``version`` option allows you to set a specific revision. You can use a tag
74
- (``version=origin/0.42``) or a branch name (``refs/remotes/origin/awesome-branch``).
75
- It defaults to ``origin/HEAD``.
76
-
77
- ### Updating workflow
78
-
79
- When you execute the ``php bin/vendors install``, for every library, the script first
80
- checks if the install directory exists.
81
-
82
- If it does not (and ONLY if it does not), it runs a ``git clone``.
83
-
84
- Then, it does a ``git fetch origin`` and a ``git reset --hard the-awesome-version``.
85
-
86
- This means that the repository will only be cloned once. If you want to perform any
87
- change of the git remote, you MUST delete the entire target directory, not only its content.
49
+ .. _Composer: http://getcomposer.org/
50
+ .. _GetComposer.org: http://getcomposer.org/
0 commit comments