-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomposer.txt
40 lines (33 loc) · 2.06 KB
/
composer.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
!Very incomplete!
Composer has a \e[32mjson\e[0m file which tells it what we *want*. It uses that to generate a \e[32mlock\e[0m file to tell the world what it has decided
to install (based on the json file) in /vendor. Both files go in git: the json is obvious, and the lock file tells other
developers what they should be using to get the same result, and will deploy those same exact versions into production, which is
usually what you want.
$ composer install
# composer will check for a lock file and install everything there in vendor.
# If there's no lock file, it will install the newest version of whatever's in the json file (as new as allowed) and then create
# the lock file based on the versions installed.
# Tell composer to install this (optionally specifying version), add it to the json file and note the installed version in the
# lock file.
$ composer require some/package[:1.2.3]
# Tell composer to check for newer versions [of a package] (as allowed) per the json file, install that or those and update the
# lock file.
$ composer update [some/package]
### Versions
# There's exact, range, hyphenated range, wildcard range, tilde range and caret range (and some stability stuff)
# Notation Means
1.0.1 1.0.1
>=1,<2 any version starting with 1. operators include: >, >=, <, <=, !=
1-2.0.0 any version starting with 1 and 2.0.0
1-2 any version starting with 1 or 2 (hyphen notation fills up the right-hand version with wildcards so it's
really 1-2.*.*)
1.0.* >=1.0 <1.1
# tilde allows _only_ the last specified digit to go up (~1 becomes ~1.0 though)
~1.2 >=1.2.0 <2
~1.2.3 >=1.2.3 <1.3
# caret is similar but allows anything until the next major version (unless current MV is 0: ^0.4 becomes >=0.4 <0.5)
^1.5.7 >=1.5.7 <2
### show what versions of packages are installed in the current project
$ composer show
### show what you did wrong, and why composer is disappointed in you
$ composer validate