Documentation code syntax highlighting (#11011)
* Add newline at end of file. * Create a uniformat in the code syntax highlighting by using the main syntax `shell` instead of the alias `bash`/`sh`. * Added (of corrected) the missing code syntax highlighting. * Split the shell commands from the text outputs. * Fix JSON samples formatting. * Checked the commands and updated the text output.pull/11014/head
parent
afeaabe089
commit
ceec6ff8e2
|
@ -76,7 +76,7 @@ running the installer when following
|
||||||
[the Download page instructions](https://getcomposer.org/download/) add the
|
[the Download page instructions](https://getcomposer.org/download/) add the
|
||||||
following parameters:
|
following parameters:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer-setup.php --install-dir=bin --filename=composer
|
php composer-setup.php --install-dir=bin --filename=composer
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ interpreter.
|
||||||
After running the installer following [the Download page instructions](https://getcomposer.org/download/)
|
After running the installer following [the Download page instructions](https://getcomposer.org/download/)
|
||||||
you can run this to move composer.phar to a directory that is in your path:
|
you can run this to move composer.phar to a directory that is in your path:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
mv composer.phar /usr/local/bin/composer
|
mv composer.phar /usr/local/bin/composer
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -138,13 +138,13 @@ Create a new `composer.bat` file alongside `composer.phar`:
|
||||||
|
|
||||||
Using cmd.exe:
|
Using cmd.exe:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
C:\bin> echo @php "%~dp0composer.phar" %*>composer.bat
|
C:\bin> echo @php "%~dp0composer.phar" %*>composer.bat
|
||||||
```
|
```
|
||||||
|
|
||||||
Using PowerShell:
|
Using PowerShell:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
PS C:\bin> Set-Content composer.bat '@php "%~dp0composer.phar" %*'
|
PS C:\bin> Set-Content composer.bat '@php "%~dp0composer.phar" %*'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -155,9 +155,11 @@ use your search engine of choice.
|
||||||
|
|
||||||
Close your current terminal. Test usage with a new terminal:
|
Close your current terminal. Test usage with a new terminal:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
C:\Users\username>composer -V
|
C:\Users\username>composer -V
|
||||||
Composer version 2.0.12 2021-04-01 10:14:59
|
```
|
||||||
|
```text
|
||||||
|
Composer version 2.4.0 2022-08-16 16:10:48
|
||||||
```
|
```
|
||||||
|
|
||||||
## Docker Image
|
## Docker Image
|
||||||
|
@ -166,7 +168,7 @@ Composer is published as Docker container in a few places, see the list in the [
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
docker pull composer/composer
|
docker pull composer/composer
|
||||||
docker run --rm -it -v "$(pwd):/app" composer/composer install
|
docker run --rm -it -v "$(pwd):/app" composer/composer install
|
||||||
```
|
```
|
||||||
|
|
|
@ -92,7 +92,7 @@ versions, how versions relate to each other, and on version constraints.
|
||||||
To initially install the defined dependencies for your project, you should run the
|
To initially install the defined dependencies for your project, you should run the
|
||||||
[`update`](03-cli.md#update-u) command.
|
[`update`](03-cli.md#update-u) command.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar update
|
php composer.phar update
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ So after fetching new changes from your VCS repository it is recommended to run
|
||||||
a Composer `install` to make sure the vendor directory is up in sync with your
|
a Composer `install` to make sure the vendor directory is up in sync with your
|
||||||
`composer.lock` file.
|
`composer.lock` file.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar install
|
php composer.phar install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ the latest versions of your dependencies. To update to the latest versions, use
|
||||||
versions (according to your `composer.json` file) and update the lock file
|
versions (according to your `composer.json` file) and update the lock file
|
||||||
with the new versions.
|
with the new versions.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar update
|
php composer.phar update
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ php composer.phar update
|
||||||
|
|
||||||
If you only want to install, upgrade or remove one dependency, you can explicitly list it as an argument:
|
If you only want to install, upgrade or remove one dependency, you can explicitly list it as an argument:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar update monolog/monolog [...]
|
php composer.phar update monolog/monolog [...]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ filename would be `src/Foo.php` containing an `Acme\Foo` class.
|
||||||
After adding the [`autoload`](04-schema.md#autoload) field, you have to re-run
|
After adding the [`autoload`](04-schema.md#autoload) field, you have to re-run
|
||||||
this command:
|
this command:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar dump-autoload
|
php composer.phar dump-autoload
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
156
doc/03-cli.md
156
doc/03-cli.md
|
@ -8,7 +8,7 @@ to see the complete list of commands, then `--help` combined with any of those
|
||||||
can give you more information.
|
can give you more information.
|
||||||
|
|
||||||
As Composer uses [symfony/console](https://github.com/symfony/console) you can call commands by short name if it's not ambiguous.
|
As Composer uses [symfony/console](https://github.com/symfony/console) you can call commands by short name if it's not ambiguous.
|
||||||
```sh
|
```shell
|
||||||
php composer.phar dump
|
php composer.phar dump
|
||||||
```
|
```
|
||||||
calls `composer dump-autoload`.
|
calls `composer dump-autoload`.
|
||||||
|
@ -55,7 +55,7 @@ In the [Libraries](02-libraries.md) chapter we looked at how to create a
|
||||||
When you run the command it will interactively ask you to fill in the fields,
|
When you run the command it will interactively ask you to fill in the fields,
|
||||||
while using some smart defaults.
|
while using some smart defaults.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar init
|
php composer.phar init
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ php composer.phar init
|
||||||
The `install` command reads the `composer.json` file from the current
|
The `install` command reads the `composer.json` file from the current
|
||||||
directory, resolves the dependencies, and installs them into `vendor`.
|
directory, resolves the dependencies, and installs them into `vendor`.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar install
|
php composer.phar install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ In order to get the latest versions of the dependencies and to update the
|
||||||
aliased as `upgrade` as it does the same as `upgrade` does if you are thinking
|
aliased as `upgrade` as it does the same as `upgrade` does if you are thinking
|
||||||
of `apt-get` or similar package managers.
|
of `apt-get` or similar package managers.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar update
|
php composer.phar update
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -150,13 +150,13 @@ into `composer.lock`.
|
||||||
|
|
||||||
If you only want to update a few packages and not all, you can list them as such:
|
If you only want to update a few packages and not all, you can list them as such:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar update vendor/package vendor/package2
|
php composer.phar update vendor/package vendor/package2
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use wildcards to update a bunch of packages at once:
|
You can also use wildcards to update a bunch of packages at once:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar update "vendor/*"
|
php composer.phar update "vendor/*"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ php composer.phar update "vendor/*"
|
||||||
If you want to downgrade a package to a specific version without changing your
|
If you want to downgrade a package to a specific version without changing your
|
||||||
composer.json you can use `--with` and provide a custom version constraint:
|
composer.json you can use `--with` and provide a custom version constraint:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar update --with vendor/package:2.0.1
|
php composer.phar update --with vendor/package:2.0.1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ Note that with the above all packages will be updated. If you only want to
|
||||||
update the package(s) for which you provide custom constraints using `--with`,
|
update the package(s) for which you provide custom constraints using `--with`,
|
||||||
you can skip `--with` and instead use constraints with the partial update syntax:
|
you can skip `--with` and instead use constraints with the partial update syntax:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar update vendor/package:2.0.1 vendor/package2:3.0.*
|
php composer.phar update vendor/package:2.0.1 vendor/package2:3.0.*
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ Specifying one of the words `mirrors`, `lock`, or `nothing` as an argument has t
|
||||||
The `require` command adds new packages to the `composer.json` file from
|
The `require` command adds new packages to the `composer.json` file from
|
||||||
the current directory. If no file exists one will be created on the fly.
|
the current directory. If no file exists one will be created on the fly.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar require
|
php composer.phar require
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ installed or updated.
|
||||||
If you do not want to choose requirements interactively, you can pass them
|
If you do not want to choose requirements interactively, you can pass them
|
||||||
to the command.
|
to the command.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar require "vendor/package:2.*" vendor/package2:dev-master
|
php composer.phar require "vendor/package:2.*" vendor/package2:dev-master
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ If you do not specify a package, Composer will prompt you to search for a packag
|
||||||
The `remove` command removes packages from the `composer.json` file from
|
The `remove` command removes packages from the `composer.json` file from
|
||||||
the current directory.
|
the current directory.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar remove vendor/package vendor/package2
|
php composer.phar remove vendor/package vendor/package2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -363,14 +363,14 @@ uninstalls them and reinstalls them. This lets you do a clean install
|
||||||
of a package if you messed with its files, or if you wish to change
|
of a package if you messed with its files, or if you wish to change
|
||||||
the installation type using --prefer-install.
|
the installation type using --prefer-install.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar reinstall acme/foo acme/bar
|
php composer.phar reinstall acme/foo acme/bar
|
||||||
```
|
```
|
||||||
|
|
||||||
You can specify more than one package name to reinstall, or use a
|
You can specify more than one package name to reinstall, or use a
|
||||||
wildcard to select several packages at once:
|
wildcard to select several packages at once:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar reinstall "acme/*"
|
php composer.phar reinstall "acme/*"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ can hold CLI tools or Composer plugins that you want to have available everywher
|
||||||
|
|
||||||
This can be used to install CLI utilities globally. Here is an example:
|
This can be used to install CLI utilities globally. Here is an example:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar global require friendsofphp/php-cs-fixer
|
php composer.phar global require friendsofphp/php-cs-fixer
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -438,13 +438,13 @@ Now the `php-cs-fixer` binary is available globally. Make sure your global
|
||||||
[vendor binaries](articles/vendor-binaries.md) directory is in your `$PATH`
|
[vendor binaries](articles/vendor-binaries.md) directory is in your `$PATH`
|
||||||
environment variable, you can get its location with the following command :
|
environment variable, you can get its location with the following command :
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar global config bin-dir --absolute
|
php composer.phar global config bin-dir --absolute
|
||||||
```
|
```
|
||||||
|
|
||||||
If you wish to update the binary later on you can run a global update:
|
If you wish to update the binary later on you can run a global update:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar global update
|
php composer.phar global update
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ The search command allows you to search through the current project's package
|
||||||
repositories. Usually this will be packagist. You pass it the terms you want
|
repositories. Usually this will be packagist. You pass it the terms you want
|
||||||
to search for.
|
to search for.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar search monolog
|
php composer.phar search monolog
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -476,44 +476,54 @@ You can also search for more than one term by passing multiple arguments.
|
||||||
|
|
||||||
To list all of the available packages, you can use the `show` command.
|
To list all of the available packages, you can use the `show` command.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar show
|
php composer.phar show
|
||||||
```
|
```
|
||||||
|
|
||||||
To filter the list you can pass a package mask using wildcards.
|
To filter the list you can pass a package mask using wildcards.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar show monolog/*
|
php composer.phar show "monolog/*"
|
||||||
|
```
|
||||||
monolog/monolog 1.19.0 Sends your logs to files, sockets, inboxes, databases and various web services
|
```text
|
||||||
|
monolog/monolog 2.4.0 Sends your logs to files, sockets, inboxes, databases and various web services
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to see the details of a certain package, you can pass the package
|
If you want to see the details of a certain package, you can pass the package
|
||||||
name.
|
name.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar show monolog/monolog
|
php composer.phar show monolog/monolog
|
||||||
|
```
|
||||||
|
```text
|
||||||
name : monolog/monolog
|
name : monolog/monolog
|
||||||
versions : master-dev, 1.0.2, 1.0.1, 1.0.0, 1.0.0-RC1
|
descrip. : Sends your logs to files, sockets, inboxes, databases and various web services
|
||||||
|
keywords : log, logging, psr-3
|
||||||
|
versions : * 1.27.1
|
||||||
type : library
|
type : library
|
||||||
names : monolog/monolog
|
license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
|
||||||
source : [git] https://github.com/Seldaek/monolog.git 3d4e60d0cbc4b888fe5ad223d77964428b1978da
|
homepage : http://github.com/Seldaek/monolog
|
||||||
dist : [zip] https://github.com/Seldaek/monolog/zipball/3d4e60d0cbc4b888fe5ad223d77964428b1978da 3d4e60d0cbc4b888fe5ad223d77964428b1978da
|
source : [git] https://github.com/Seldaek/monolog.git 904713c5929655dc9b97288b69cfeedad610c9a1
|
||||||
license : MIT
|
dist : [zip] https://api.github.com/repos/Seldaek/monolog/zipball/904713c5929655dc9b97288b69cfeedad610c9a1 904713c5929655dc9b97288b69cfeedad610c9a1
|
||||||
|
names : monolog/monolog, psr/log-implementation
|
||||||
|
|
||||||
|
support
|
||||||
|
issues : https://github.com/Seldaek/monolog/issues
|
||||||
|
source : https://github.com/Seldaek/monolog/tree/1.27.1
|
||||||
|
|
||||||
autoload
|
autoload
|
||||||
psr-0
|
psr-4
|
||||||
Monolog : src/
|
Monolog\ => src/Monolog
|
||||||
|
|
||||||
requires
|
requires
|
||||||
php >=5.3.0
|
php >=5.3.0
|
||||||
|
psr/log ~1.0
|
||||||
```
|
```
|
||||||
|
|
||||||
You can even pass the package version, which will tell you the details of that
|
You can even pass the package version, which will tell you the details of that
|
||||||
specific version.
|
specific version.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar show monolog/monolog 1.0.2
|
php composer.phar show monolog/monolog 1.0.2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -624,10 +634,12 @@ The `depends` command tells you which other packages depend on a certain
|
||||||
package. As with installation `require-dev` relationships are only considered
|
package. As with installation `require-dev` relationships are only considered
|
||||||
for the root package.
|
for the root package.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar depends doctrine/lexer
|
php composer.phar depends doctrine/lexer
|
||||||
doctrine/annotations v1.2.7 requires doctrine/lexer (1.*)
|
```
|
||||||
doctrine/common v2.6.1 requires doctrine/lexer (1.*)
|
```text
|
||||||
|
doctrine/annotations 1.13.3 requires doctrine/lexer (1.*)
|
||||||
|
doctrine/common 2.13.3 requires doctrine/lexer (^1.0)
|
||||||
```
|
```
|
||||||
|
|
||||||
You can optionally specify a version constraint after the package to limit the
|
You can optionally specify a version constraint after the package to limit the
|
||||||
|
@ -636,16 +648,17 @@ search.
|
||||||
Add the `--tree` or `-t` flag to show a recursive tree of why the package is
|
Add the `--tree` or `-t` flag to show a recursive tree of why the package is
|
||||||
depended upon, for example:
|
depended upon, for example:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar depends psr/log -t
|
php composer.phar depends psr/log -t
|
||||||
psr/log 1.0.0 Common interface for logging libraries
|
```
|
||||||
|- aboutyou/app-sdk 2.6.11 (requires psr/log 1.0.*)
|
```text
|
||||||
| `- __root__ (requires aboutyou/app-sdk ^2.6)
|
psr/log 1.1.4 Common interface for logging libraries
|
||||||
|- monolog/monolog 1.17.2 (requires psr/log ~1.0)
|
├──composer/composer 2.4.x-dev (requires psr/log ^1.0 || ^2.0 || ^3.0)
|
||||||
| `- laravel/framework v5.2.16 (requires monolog/monolog ~1.11)
|
├──composer/composer dev-main (requires psr/log ^1.0 || ^2.0 || ^3.0)
|
||||||
| `- __root__ (requires laravel/framework ^5.2)
|
├──composer/xdebug-handler 3.0.3 (requires psr/log ^1 || ^2 || ^3)
|
||||||
`- symfony/symfony v3.0.2 (requires psr/log ~1.0)
|
│ ├──composer/composer 2.4.x-dev (requires composer/xdebug-handler ^2.0.2 || ^3.0.3)
|
||||||
`- __root__ (requires symfony/symfony ^3.0)
|
│ └──composer/composer dev-main (requires composer/xdebug-handler ^2.0.2 || ^3.0.3)
|
||||||
|
└──symfony/console v5.4.11 (conflicts psr/log >=3) (circular dependency aborted here)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
@ -660,19 +673,23 @@ from being installed. Specify a version constraint to verify whether upgrades
|
||||||
can be performed in your project, and if not why not. See the following
|
can be performed in your project, and if not why not. See the following
|
||||||
example:
|
example:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar prohibits symfony/symfony 3.1
|
php composer.phar prohibits symfony/symfony 3.1
|
||||||
laravel/framework v5.2.16 requires symfony/var-dumper (2.8.*|3.0.*)
|
```
|
||||||
|
```text
|
||||||
|
laravel/framework v5.2.16 requires symfony/var-dumper (2.8.*|3.0.*)
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that you can also specify platform requirements, for example to check
|
Note that you can also specify platform requirements, for example to check
|
||||||
whether you can upgrade your server to PHP 8.0:
|
whether you can upgrade your server to PHP 8.0:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar prohibits php 8
|
php composer.phar prohibits php 8
|
||||||
doctrine/cache v1.6.0 requires php (~5.5|~7.0)
|
```
|
||||||
doctrine/common v2.6.1 requires php (~5.5|~7.0)
|
```text
|
||||||
doctrine/instantiator 1.0.5 requires php (>=5.3,<8.0-DEV)
|
doctrine/cache v1.6.0 requires php (~5.5|~7.0)
|
||||||
|
doctrine/common v2.6.1 requires php (~5.5|~7.0)
|
||||||
|
doctrine/instantiator 1.0.5 requires php (>=5.3,<8.0-DEV)
|
||||||
```
|
```
|
||||||
|
|
||||||
As with `depends` you can request a recursive lookup, which will list all
|
As with `depends` you can request a recursive lookup, which will list all
|
||||||
|
@ -689,7 +706,7 @@ You should always run the `validate` command before you commit your
|
||||||
`composer.json` file, and before you tag a release. It will check if your
|
`composer.json` file, and before you tag a release. It will check if your
|
||||||
`composer.json` is valid.
|
`composer.json` is valid.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar validate
|
php composer.phar validate
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -707,16 +724,17 @@ If you often need to modify the code of your dependencies and they are
|
||||||
installed from source, the `status` command allows you to check if you have
|
installed from source, the `status` command allows you to check if you have
|
||||||
local changes in any of them.
|
local changes in any of them.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar status
|
php composer.phar status
|
||||||
```
|
```
|
||||||
|
|
||||||
With the `--verbose` option you get some more information about what was
|
With the `--verbose` option you get some more information about what was
|
||||||
changed:
|
changed:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar status -v
|
php composer.phar status -v
|
||||||
|
```
|
||||||
|
```text
|
||||||
You have changes in the following dependencies:
|
You have changes in the following dependencies:
|
||||||
vendor/seld/jsonlint:
|
vendor/seld/jsonlint:
|
||||||
M README.mdown
|
M README.mdown
|
||||||
|
@ -727,20 +745,20 @@ vendor/seld/jsonlint:
|
||||||
To update Composer itself to the latest version, run the `self-update`
|
To update Composer itself to the latest version, run the `self-update`
|
||||||
command. It will replace your `composer.phar` with the latest version.
|
command. It will replace your `composer.phar` with the latest version.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar self-update
|
php composer.phar self-update
|
||||||
```
|
```
|
||||||
|
|
||||||
If you would like to instead update to a specific release specify it:
|
If you would like to instead update to a specific release specify it:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar self-update 1.0.0-alpha7
|
php composer.phar self-update 2.4.0-RC1
|
||||||
```
|
```
|
||||||
|
|
||||||
If you have installed Composer for your entire system (see [global installation](00-intro.md#globally)),
|
If you have installed Composer for your entire system (see [global installation](00-intro.md#globally)),
|
||||||
you may have to run the command with `root` privileges
|
you may have to run the command with `root` privileges
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
sudo -H composer self-update
|
sudo -H composer self-update
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -768,7 +786,7 @@ in either the local `composer.json` file or the global `config.json` file.
|
||||||
|
|
||||||
Additionally it lets you edit most properties in the local `composer.json`.
|
Additionally it lets you edit most properties in the local `composer.json`.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config --list
|
php composer.phar config --list
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -813,13 +831,13 @@ See the [Config](06-config.md) chapter for valid configuration options.
|
||||||
In addition to modifying the config section, the `config` command also supports making
|
In addition to modifying the config section, the `config` command also supports making
|
||||||
changes to the repositories section by using it the following way:
|
changes to the repositories section by using it the following way:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config repositories.foo vcs https://github.com/foo/bar
|
php composer.phar config repositories.foo vcs https://github.com/foo/bar
|
||||||
```
|
```
|
||||||
|
|
||||||
If your repository requires more configuration options, you can instead pass its JSON representation :
|
If your repository requires more configuration options, you can instead pass its JSON representation :
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config repositories.foo '{"type": "vcs", "url": "http://svn.example.org/my-project/", "trunk-path": "master"}'
|
php composer.phar config repositories.foo '{"type": "vcs", "url": "http://svn.example.org/my-project/", "trunk-path": "master"}'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -828,7 +846,7 @@ php composer.phar config repositories.foo '{"type": "vcs", "url": "http://svn.ex
|
||||||
In addition to modifying the config section, the `config` command also supports making
|
In addition to modifying the config section, the `config` command also supports making
|
||||||
changes to the extra section by using it the following way:
|
changes to the extra section by using it the following way:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config extra.foo.bar value
|
php composer.phar config extra.foo.bar value
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -838,7 +856,7 @@ would set `"extra": { "foo": { "bar": "value" } }`.
|
||||||
If you have a complex value to add/modify, you can use the `--json` and `--merge` flags
|
If you have a complex value to add/modify, you can use the `--json` and `--merge` flags
|
||||||
to edit extra fields as json:
|
to edit extra fields as json:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config --json extra.foo.bar '{"baz": true, "qux": []}'
|
php composer.phar config --json extra.foo.bar '{"baz": true, "qux": []}'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -861,7 +879,7 @@ provide a version as a third argument, otherwise the latest version is used.
|
||||||
|
|
||||||
If the directory does not currently exist, it will be created during installation.
|
If the directory does not currently exist, it will be created during installation.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar create-project doctrine/orm path "2.2.*"
|
php composer.phar create-project doctrine/orm path "2.2.*"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -994,7 +1012,7 @@ If you think you found a bug, or something is behaving strangely, you might
|
||||||
want to run the `diagnose` command to perform automated checks for many common
|
want to run the `diagnose` command to perform automated checks for many common
|
||||||
problems.
|
problems.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar diagnose
|
php composer.phar diagnose
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1004,7 +1022,7 @@ This command is used to generate a zip/tar archive for a given package in a
|
||||||
given version. It can also be used to archive your entire project without
|
given version. It can also be used to archive your entire project without
|
||||||
excluded/ignored files.
|
excluded/ignored files.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar archive vendor/package 2.0.21 --format=zip
|
php composer.phar archive vendor/package 2.0.21 --format=zip
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1022,7 +1040,7 @@ for possible security issues. It checks for and
|
||||||
lists security vulnerability advisories according to the
|
lists security vulnerability advisories according to the
|
||||||
[Packagist.org api](https://packagist.org/apidoc#list-security-advisories).
|
[Packagist.org api](https://packagist.org/apidoc#list-security-advisories).
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar audit
|
php composer.phar audit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1036,7 +1054,7 @@ php composer.phar audit
|
||||||
|
|
||||||
To get more information about a certain command, you can use `help`.
|
To get more information about a certain command, you can use `help`.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar help install
|
php composer.phar help install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1059,7 +1077,7 @@ By setting the `COMPOSER` env variable it is possible to set the filename of
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
COMPOSER=composer-other.json php composer.phar install
|
COMPOSER=composer-other.json php composer.phar install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -182,8 +182,8 @@ An Example for disjunctive licenses:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"license": [
|
"license": [
|
||||||
"LGPL-2.1-only",
|
"LGPL-2.1-only",
|
||||||
"GPL-3.0-or-later"
|
"GPL-3.0-or-later"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -385,8 +385,8 @@ Example:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"require" : {
|
"require": {
|
||||||
"php" : ">=7.4",
|
"php": ">=7.4",
|
||||||
"ext-mbstring": "*"
|
"ext-mbstring": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -861,16 +861,16 @@ override packages from it.
|
||||||
Using JSON object notation is also possible. However, JSON key/value pairs
|
Using JSON object notation is also possible. However, JSON key/value pairs
|
||||||
are to be considered unordered so consistent behaviour cannot be guaranteed.
|
are to be considered unordered so consistent behaviour cannot be guaranteed.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"repositories": {
|
"repositories": {
|
||||||
"foo": {
|
"foo": {
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"url": "http://packages.foo.com"
|
"url": "http://packages.foo.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### config <span>([root-only](04-schema.md#root-package))</span>
|
### config <span>([root-only](04-schema.md#root-package))</span>
|
||||||
|
|
||||||
|
|
|
@ -646,9 +646,10 @@ those private packages:
|
||||||
|
|
||||||
Each zip artifact is a ZIP archive with `composer.json` in root folder:
|
Each zip artifact is a ZIP archive with `composer.json` in root folder:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
unzip -l acme-corp-parser-10.3.5.zip
|
unzip -l acme-corp-parser-10.3.5.zip
|
||||||
|
```
|
||||||
|
```text
|
||||||
composer.json
|
composer.json
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
@ -665,11 +666,11 @@ you to depend on a local directory, either absolute or relative. This can be
|
||||||
especially useful when dealing with monolithic repositories.
|
especially useful when dealing with monolithic repositories.
|
||||||
|
|
||||||
For instance, if you have the following directory structure in your repository:
|
For instance, if you have the following directory structure in your repository:
|
||||||
```
|
```text
|
||||||
...
|
...
|
||||||
├── apps
|
├── apps
|
||||||
│ └── my-app
|
│ └── my-app
|
||||||
│ └── composer.json
|
│ └── composer.json
|
||||||
├── packages
|
├── packages
|
||||||
│ └── my-package
|
│ └── my-package
|
||||||
│ └── composer.json
|
│ └── composer.json
|
||||||
|
@ -797,7 +798,7 @@ You can disable the default Packagist.org repository by adding this to your
|
||||||
|
|
||||||
You can disable Packagist.org globally by using the global config flag:
|
You can disable Packagist.org globally by using the global config flag:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
php composer.phar config -g repo.packagist false
|
php composer.phar config -g repo.packagist false
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ Add this to your project's root `composer.json`:
|
||||||
|
|
||||||
Or let Composer add it for you with:
|
Or let Composer add it for you with:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
php composer.phar require "monolog/monolog:dev-bugfix as 1.0.x-dev"
|
php composer.phar require "monolog/monolog:dev-bugfix as 1.0.x-dev"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ For all authentication methods it is possible to edit them using the command lin
|
||||||
|
|
||||||
To manually edit it, run:
|
To manually edit it, run:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config --global --editor [--auth]
|
php composer.phar config --global --editor [--auth]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ Manually editing this file instead of using the command line may result in inval
|
||||||
To fix this you need to open the file in an editor and fix the error. To find the location of
|
To fix this you need to open the file in an editor and fix the error. To find the location of
|
||||||
your global `auth.json`, execute:
|
your global `auth.json`, execute:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config --global home
|
php composer.phar config --global home
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -117,18 +117,18 @@ Read more about the usage of this environment variable [here](../03-cli.md#compo
|
||||||
|
|
||||||
### Command line http-basic
|
### Command line http-basic
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] http-basic.repo.example.org username password
|
php composer.phar config [--global] http-basic.repo.example.org username password
|
||||||
```
|
```
|
||||||
|
|
||||||
In the above command, the config key `http-basic.repo.example.org` consists of two parts:
|
In the above command, the config key `http-basic.repo.example.org` consists of two parts:
|
||||||
|
|
||||||
- `http-basic` is the authentication method.
|
- `http-basic` is the authentication method.
|
||||||
- `repo.example.org` is the repository host name, you should replace it with the host name of your repository.
|
- `repo.example.org` is the repository host name, you should replace it with the host name of your repository.
|
||||||
|
|
||||||
### Manual http-basic
|
### Manual http-basic
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] --editor --auth
|
php composer.phar config [--global] --editor --auth
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -154,13 +154,13 @@ If the username e.g. is an email address it needs to be passed as `name%40exampl
|
||||||
|
|
||||||
### Command line inline http-basic
|
### Command line inline http-basic
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] repositories composer.unique-name https://username:password@repo.example.org
|
php composer.phar config [--global] repositories composer.unique-name https://username:password@repo.example.org
|
||||||
```
|
```
|
||||||
|
|
||||||
### Manual inline http-basic
|
### Manual inline http-basic
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] --editor
|
php composer.phar config [--global] --editor
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -179,18 +179,18 @@ php composer.phar config [--global] --editor
|
||||||
|
|
||||||
### Command line HTTP Bearer authentication
|
### Command line HTTP Bearer authentication
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] bearer.repo.example.org token
|
php composer.phar config [--global] bearer.repo.example.org token
|
||||||
```
|
```
|
||||||
|
|
||||||
In the above command, the config key `bearer.repo.example.org` consists of two parts:
|
In the above command, the config key `bearer.repo.example.org` consists of two parts:
|
||||||
|
|
||||||
- `bearer` is the authentication method.
|
- `bearer` is the authentication method.
|
||||||
- `repo.example.org` is the repository host name, you should replace it with the host name of your repository.
|
- `repo.example.org` is the repository host name, you should replace it with the host name of your repository.
|
||||||
|
|
||||||
### Manual HTTP Bearer authentication
|
### Manual HTTP Bearer authentication
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] --editor --auth
|
php composer.phar config [--global] --editor --auth
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ php composer.phar config [--global] --editor --auth
|
||||||
|
|
||||||
### Manual custom token authentication
|
### Manual custom token authentication
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] --editor
|
php composer.phar config [--global] --editor
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -218,11 +218,11 @@ php composer.phar config [--global] --editor
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"url": "https://example.org",
|
"url": "https://example.org",
|
||||||
"options": {
|
"options": {
|
||||||
"http": {
|
"http": {
|
||||||
"header": [
|
"header": [
|
||||||
"API-TOKEN: YOUR-API-TOKEN"
|
"API-TOKEN: YOUR-API-TOKEN"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -236,7 +236,7 @@ php composer.phar config [--global] --editor
|
||||||
|
|
||||||
### Command line gitlab-oauth
|
### Command line gitlab-oauth
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] gitlab-oauth.gitlab.example.org token
|
php composer.phar config [--global] gitlab-oauth.gitlab.example.org token
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ In the above command, the config key `gitlab-oauth.gitlab.example.org` consists
|
||||||
|
|
||||||
### Manual gitlab-oauth
|
### Manual gitlab-oauth
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] --editor --auth
|
php composer.phar config [--global] --editor --auth
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ When creating a gitlab token manually, make sure it has either the `read_api` or
|
||||||
|
|
||||||
### Command line gitlab-token
|
### Command line gitlab-token
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] gitlab-token.gitlab.example.org token
|
php composer.phar config [--global] gitlab-token.gitlab.example.org token
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ In the above command, the config key `gitlab-token.gitlab.example.org` consists
|
||||||
|
|
||||||
### Manual gitlab-token
|
### Manual gitlab-token
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] --editor --auth
|
php composer.phar config [--global] --editor --auth
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ Read more about [Personal Access Tokens](https://docs.github.com/en/authenticati
|
||||||
|
|
||||||
### Command line github-oauth
|
### Command line github-oauth
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] github-oauth.github.com token
|
php composer.phar config [--global] github-oauth.github.com token
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ In the above command, the config key `github-oauth.github.com` consists of two p
|
||||||
|
|
||||||
### Manual github-oauth
|
### Manual github-oauth
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] --editor --auth
|
php composer.phar config [--global] --editor --auth
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ The BitBucket driver uses OAuth to access your private repositories via the BitB
|
||||||
|
|
||||||
### Command line bitbucket-oauth
|
### Command line bitbucket-oauth
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] bitbucket-oauth.bitbucket.org consumer-key consumer-secret
|
php composer.phar config [--global] bitbucket-oauth.bitbucket.org consumer-key consumer-secret
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ In the above command, the config key `bitbucket-oauth.bitbucket.org` consists of
|
||||||
|
|
||||||
### Manual bitbucket-oauth
|
### Manual bitbucket-oauth
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar config [--global] --editor --auth
|
php composer.phar config [--global] --editor --auth
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ That's how packages can add a dependency on the used PHP version:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"require" : {
|
"require": {
|
||||||
"php" : ">=7.4"
|
"php": ">=7.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -61,7 +61,7 @@ autoloader are considered the application "runtime".
|
||||||
Starting with version 2.0, Composer makes [additional features](../07-runtime.md) (besides registering the class autoloader) available to the application runtime environment.
|
Starting with version 2.0, Composer makes [additional features](../07-runtime.md) (besides registering the class autoloader) available to the application runtime environment.
|
||||||
|
|
||||||
Similar to `composer-plugin-api`, not every Composer release adds new runtime features,
|
Similar to `composer-plugin-api`, not every Composer release adds new runtime features,
|
||||||
thus the version of `composer-runtimeapi` is also increased independently from Composer's version.
|
thus the version of `composer-runtimeapi` is also increased independently from Composer's version.
|
||||||
|
|
||||||
## Composer package `composer`
|
## Composer package `composer`
|
||||||
|
|
||||||
|
|
|
@ -48,14 +48,14 @@ The default file Satis looks for is `satis.json` in the root of the repository.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"name": "my/repository",
|
"name": "my/repository",
|
||||||
"homepage": "http://packages.example.org",
|
"homepage": "http://packages.example.org",
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{ "type": "vcs", "url": "https://github.com/mycompany/privaterepo" },
|
{ "type": "vcs", "url": "https://github.com/mycompany/privaterepo" },
|
||||||
{ "type": "vcs", "url": "http://svn.example.org/private/repo" },
|
{ "type": "vcs", "url": "http://svn.example.org/private/repo" },
|
||||||
{ "type": "vcs", "url": "https://github.com/mycompany/privaterepo2" }
|
{ "type": "vcs", "url": "https://github.com/mycompany/privaterepo2" }
|
||||||
],
|
],
|
||||||
"require-all": true
|
"require-all": true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -66,16 +66,16 @@ or another constraint if you want really specific versions.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{ "type": "vcs", "url": "https://github.com/mycompany/privaterepo" },
|
{ "type": "vcs", "url": "https://github.com/mycompany/privaterepo" },
|
||||||
{ "type": "vcs", "url": "http://svn.example.org/private/repo" },
|
{ "type": "vcs", "url": "http://svn.example.org/private/repo" },
|
||||||
{ "type": "vcs", "url": "https://github.com/mycompany/privaterepo2" }
|
{ "type": "vcs", "url": "https://github.com/mycompany/privaterepo2" }
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"company/package": "*",
|
"company/package": "*",
|
||||||
"company/package2": "*",
|
"company/package2": "*",
|
||||||
"company/package3": "2.0.0"
|
"company/package3": "2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -119,11 +119,11 @@ to declare a *name* for all your package (this only work on VCS repositories typ
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{ "name": "company/privaterepo", "type": "vcs", "url": "https://github.com/mycompany/privaterepo" },
|
{ "name": "company/privaterepo", "type": "vcs", "url": "https://github.com/mycompany/privaterepo" },
|
||||||
{ "name": "private/repo", "type": "vcs", "url": "http://svn.example.org/private/repo" },
|
{ "name": "private/repo", "type": "vcs", "url": "http://svn.example.org/private/repo" },
|
||||||
{ "name": "mycompany/privaterepo2", "type": "vcs", "url": "https://github.com/mycompany/privaterepo2" }
|
{ "name": "mycompany/privaterepo2", "type": "vcs", "url": "https://github.com/mycompany/privaterepo2" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -142,12 +142,12 @@ will update itself.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"repositories": [ { "type": "composer", "url": "http://packages.example.org/" } ],
|
"repositories": [ { "type": "composer", "url": "http://packages.example.org/" } ],
|
||||||
"require": {
|
"require": {
|
||||||
"company/package": "1.2.0",
|
"company/package": "1.2.0",
|
||||||
"company/package2": "1.5.2",
|
"company/package2": "1.5.2",
|
||||||
"company/package3": "dev-master"
|
"company/package3": "dev-master"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -161,17 +161,17 @@ Example using a custom repository using SSH (requires the SSH2 PECL extension):
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"repositories": [{
|
"repositories": [{
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"url": "ssh2.sftp://example.org",
|
"url": "ssh2.sftp://example.org",
|
||||||
"options": {
|
"options": {
|
||||||
"ssh2": {
|
"ssh2": {
|
||||||
"username": "composer",
|
"username": "composer",
|
||||||
"pubkey_file": "/home/composer/.ssh/id_rsa.pub",
|
"pubkey_file": "/home/composer/.ssh/id_rsa.pub",
|
||||||
"privkey_file": "/home/composer/.ssh/id_rsa"
|
"privkey_file": "/home/composer/.ssh/id_rsa"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -181,15 +181,15 @@ Example using SSL/TLS (HTTPS) using a client certificate:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"repositories": [{
|
"repositories": [{
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"url": "https://example.org",
|
"url": "https://example.org",
|
||||||
"options": {
|
"options": {
|
||||||
"ssl": {
|
"ssl": {
|
||||||
"local_cert": "/home/composer/.ssl/composer.pem"
|
"local_cert": "/home/composer/.ssl/composer.pem"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -199,17 +199,17 @@ Example using a custom HTTP Header field for token authentication:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"repositories": [{
|
"repositories": [{
|
||||||
"type": "composer",
|
"type": "composer",
|
||||||
"url": "https://example.org",
|
"url": "https://example.org",
|
||||||
"options": {
|
"options": {
|
||||||
"http": {
|
"http": {
|
||||||
"header": [
|
"header": [
|
||||||
"API-TOKEN: YOUR-API-TOKEN"
|
"API-TOKEN: YOUR-API-TOKEN"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -231,14 +231,14 @@ and thus installations usually take a lot longer.
|
||||||
To enable your satis installation to create downloads for all (Git, Mercurial
|
To enable your satis installation to create downloads for all (Git, Mercurial
|
||||||
and Subversion) your packages, add the following to your `satis.json`:
|
and Subversion) your packages, add the following to your `satis.json`:
|
||||||
|
|
||||||
``` json
|
```json
|
||||||
{
|
{
|
||||||
"archive": {
|
"archive": {
|
||||||
"directory": "dist",
|
"directory": "dist",
|
||||||
"format": "tar",
|
"format": "tar",
|
||||||
"prefix-url": "https://amazing.cdn.example.org",
|
"prefix-url": "https://amazing.cdn.example.org",
|
||||||
"skip-dev": true
|
"skip-dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -287,10 +287,10 @@ add the following to your `satis.json`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"abandoned": {
|
"abandoned": {
|
||||||
"company/package": true,
|
"company/package": true,
|
||||||
"company/package2": "company/newpackage"
|
"company/package2": "company/newpackage"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -309,8 +309,8 @@ complete local mirror of packages. Add the following to your `satis.json`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"require-dependencies": true,
|
"require-dependencies": true,
|
||||||
"require-dev-dependencies": true
|
"require-dev-dependencies": true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -339,4 +339,4 @@ is set to true.
|
||||||
[ssl context options]: https://secure.php.net/manual/en/context.ssl.php
|
[ssl context options]: https://secure.php.net/manual/en/context.ssl.php
|
||||||
[Twig]: https://twig.sensiolabs.org/
|
[Twig]: https://twig.sensiolabs.org/
|
||||||
[config schema]: https://getcomposer.org/doc/04-schema.md#config
|
[config schema]: https://getcomposer.org/doc/04-schema.md#config
|
||||||
[notify-batch]: https://getcomposer.org/doc/05-repositories.md#notify-batch
|
[notify-batch]: https://getcomposer.org/doc/05-repositories.md#notify-batch
|
||||||
|
|
|
@ -351,7 +351,7 @@ The necessary configuration files are automatically loaded, in case your plugin
|
||||||
|
|
||||||
To make use of it, your Composer plugin project needs a [PHPStan config file][12], which includes the `phpstan/rules.neon` file:
|
To make use of it, your Composer plugin project needs a [PHPStan config file][12], which includes the `phpstan/rules.neon` file:
|
||||||
|
|
||||||
```
|
```neon
|
||||||
includes:
|
includes:
|
||||||
- vendor/composer/composer/phpstan/rules.neon
|
- vendor/composer/composer/phpstan/rules.neon
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ To resolve the conflict when we merge these two branches:
|
||||||
Before committing, make sure the resulting `composer.json` and `composer.lock` files are valid.
|
Before committing, make sure the resulting `composer.json` and `composer.lock` files are valid.
|
||||||
To do this, run the following commands:
|
To do this, run the following commands:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar validate
|
php composer.phar validate
|
||||||
php composer.phar install [--dry-run]
|
php composer.phar install [--dry-run]
|
||||||
```
|
```
|
||||||
|
|
|
@ -194,7 +194,7 @@ objects:
|
||||||
|
|
||||||
If you would like to run the scripts for an event manually, the syntax is:
|
If you would like to run the scripts for an event manually, the syntax is:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar run-script [--dev] [--no-dev] script
|
php composer.phar run-script [--dev] [--no-dev] script
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -270,14 +270,14 @@ composer.json configuration:
|
||||||
It's also possible to set the global environment variable to disable the timeout
|
It's also possible to set the global environment variable to disable the timeout
|
||||||
of all following scripts in the current terminal environment:
|
of all following scripts in the current terminal environment:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
export COMPOSER_PROCESS_TIMEOUT=0
|
export COMPOSER_PROCESS_TIMEOUT=0
|
||||||
```
|
```
|
||||||
|
|
||||||
To disable the timeout of a single script call, you must use the `run-script` composer
|
To disable the timeout of a single script call, you must use the `run-script` composer
|
||||||
command and specify the `--timeout` parameter:
|
command and specify the `--timeout` parameter:
|
||||||
|
|
||||||
```
|
```shell
|
||||||
php composer.phar run-script --timeout=0 test
|
php composer.phar run-script --timeout=0 test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -302,10 +302,10 @@ You can also refer a script and pass it new arguments:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tests": "phpunit",
|
"tests": "phpunit",
|
||||||
"testsVerbose": "@tests -vvv"
|
"testsVerbose": "@tests -vvv"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ In this case, the PHP `memory_limit` should be increased.
|
||||||
|
|
||||||
To get the current `memory_limit` value, run:
|
To get the current `memory_limit` value, run:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php -r "echo ini_get('memory_limit').PHP_EOL;"
|
php -r "echo ini_get('memory_limit').PHP_EOL;"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -171,13 +171,13 @@ memory_limit = -1
|
||||||
|
|
||||||
Composer also respects a memory limit defined by the `COMPOSER_MEMORY_LIMIT` environment variable:
|
Composer also respects a memory limit defined by the `COMPOSER_MEMORY_LIMIT` environment variable:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
COMPOSER_MEMORY_LIMIT=-1 composer.phar <...>
|
COMPOSER_MEMORY_LIMIT=-1 composer.phar <...>
|
||||||
```
|
```
|
||||||
|
|
||||||
Or, you can increase the limit with a command-line argument:
|
Or, you can increase the limit with a command-line argument:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php -d memory_limit=-1 composer.phar <...>
|
php -d memory_limit=-1 composer.phar <...>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -222,9 +222,10 @@ If Composer shows proc_open() fork failed on some commands:
|
||||||
|
|
||||||
This could be happening because the VPS runs out of memory and has no Swap space enabled.
|
This could be happening because the VPS runs out of memory and has no Swap space enabled.
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
free -m
|
free -m
|
||||||
|
```
|
||||||
|
```text
|
||||||
total used free shared buffers cached
|
total used free shared buffers cached
|
||||||
Mem: 2048 357 1690 0 0 237
|
Mem: 2048 357 1690 0 0 237
|
||||||
-/+ buffers/cache: 119 1928
|
-/+ buffers/cache: 119 1928
|
||||||
|
@ -233,7 +234,7 @@ Swap: 0 0 0
|
||||||
|
|
||||||
To enable the swap you can use for example:
|
To enable the swap you can use for example:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
|
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
|
||||||
/sbin/mkswap /var/swap.1
|
/sbin/mkswap /var/swap.1
|
||||||
/bin/chmod 0600 /var/swap.1
|
/bin/chmod 0600 /var/swap.1
|
||||||
|
@ -282,7 +283,7 @@ If you have been pointed to this page, you want to check a few things:
|
||||||
|
|
||||||
You may run into errors if IPv6 is not configured correctly. A common error is:
|
You may run into errors if IPv6 is not configured correctly. A common error is:
|
||||||
|
|
||||||
```
|
```text
|
||||||
The "https://getcomposer.org/version" file could not be downloaded: failed to
|
The "https://getcomposer.org/version" file could not be downloaded: failed to
|
||||||
open stream: Operation timed out
|
open stream: Operation timed out
|
||||||
```
|
```
|
||||||
|
@ -295,7 +296,7 @@ following workarounds:
|
||||||
On linux, it seems that running this command helps to make ipv4 traffic have a
|
On linux, it seems that running this command helps to make ipv4 traffic have a
|
||||||
higher priority than ipv6, which is a better alternative than disabling ipv6 entirely:
|
higher priority than ipv6, which is a better alternative than disabling ipv6 entirely:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
|
sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -307,13 +308,13 @@ On windows the only way is to disable ipv6 entirely I am afraid (either in windo
|
||||||
|
|
||||||
Get name of your network device:
|
Get name of your network device:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
networksetup -listallnetworkservices
|
networksetup -listallnetworkservices
|
||||||
```
|
```
|
||||||
|
|
||||||
Disable IPv6 on that device (in this case "Wi-Fi"):
|
Disable IPv6 on that device (in this case "Wi-Fi"):
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
networksetup -setv6off Wi-Fi
|
networksetup -setv6off Wi-Fi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -321,7 +322,7 @@ Run Composer ...
|
||||||
|
|
||||||
You can enable IPv6 again with:
|
You can enable IPv6 again with:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
networksetup -setv6automatic Wi-Fi
|
networksetup -setv6automatic Wi-Fi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -340,7 +341,7 @@ The reason for this is a SSH Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1
|
||||||
|
|
||||||
As a workaround, open a SSH connection to your Git host before running Composer:
|
As a workaround, open a SSH connection to your Git host before running Composer:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
ssh -t git@mygitserver.tld
|
ssh -t git@mygitserver.tld
|
||||||
php composer.phar update
|
php composer.phar update
|
||||||
```
|
```
|
||||||
|
@ -368,7 +369,7 @@ an unexpected result such as an unresolvable set of dependencies or conflicts wh
|
||||||
think Composer is wrong, you might want to disable the optimizer by using the environment
|
think Composer is wrong, you might want to disable the optimizer by using the environment
|
||||||
variable `COMPOSER_POOL_OPTIMIZER` and run the update again like so:
|
variable `COMPOSER_POOL_OPTIMIZER` and run the update again like so:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
COMPOSER_POOL_OPTIMIZER=0 php composer.phar update
|
COMPOSER_POOL_OPTIMIZER=0 php composer.phar update
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -27,14 +27,20 @@ in `composer.json`).
|
||||||
*For the following discussion, let's assume the following sample library
|
*For the following discussion, let's assume the following sample library
|
||||||
repository:*
|
repository:*
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
~/my-library$ git branch
|
~/my-library$ git branch
|
||||||
|
```
|
||||||
|
```text
|
||||||
v1
|
v1
|
||||||
v2
|
v2
|
||||||
my-feature
|
my-feature
|
||||||
another-feature
|
another-feature
|
||||||
|
```
|
||||||
|
|
||||||
|
```shell
|
||||||
~/my-library$ git tag
|
~/my-library$ git tag
|
||||||
|
```
|
||||||
|
```text
|
||||||
v1.0
|
v1.0
|
||||||
v1.0.1
|
v1.0.1
|
||||||
v1.0.2
|
v1.0.2
|
||||||
|
|
|
@ -6,7 +6,7 @@ it should not be relied upon in the long term.
|
||||||
|
|
||||||
An alternative is to use this script which only works with UNIX utilities:
|
An alternative is to use this script which only works with UNIX utilities:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
||||||
|
@ -34,7 +34,7 @@ a specific version from GitHub's history. The commit hash should be enough to
|
||||||
give it uniqueness and authenticity as long as you can trust the GitHub servers.
|
give it uniqueness and authenticity as long as you can trust the GitHub servers.
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
```bash
|
```shell
|
||||||
wget https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer -O - -q | php -- --quiet
|
wget https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer -O - -q | php -- --quiet
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ Composer command.
|
||||||
You can disable plugins and scripts during package installation or updates with the following
|
You can disable plugins and scripts during package installation or updates with the following
|
||||||
syntax so only Composer's code, and no third party code, will execute:
|
syntax so only Composer's code, and no third party code, will execute:
|
||||||
|
|
||||||
```sh
|
```shell
|
||||||
php composer.phar install --no-plugins --no-scripts ...
|
php composer.phar install --no-plugins --no-scripts ...
|
||||||
php composer.phar update --no-plugins --no-scripts ...
|
php composer.phar update --no-plugins --no-scripts ...
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue