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
|
||||
following parameters:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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/)
|
||||
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
|
||||
```
|
||||
|
||||
|
@ -138,13 +138,13 @@ Create a new `composer.bat` file alongside `composer.phar`:
|
|||
|
||||
Using cmd.exe:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
C:\bin> echo @php "%~dp0composer.phar" %*>composer.bat
|
||||
```
|
||||
|
||||
Using PowerShell:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
|
@ -166,7 +168,7 @@ Composer is published as Docker container in a few places, see the list in the [
|
|||
|
||||
Example usage:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
docker pull composer/composer
|
||||
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
|
||||
[`update`](03-cli.md#update-u) command.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
`composer.lock` file.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
with the new versions.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
this command:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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.
|
||||
|
||||
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
|
||||
```
|
||||
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,
|
||||
while using some smart defaults.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar init
|
||||
```
|
||||
|
||||
|
@ -83,7 +83,7 @@ php composer.phar init
|
|||
The `install` command reads the `composer.json` file from the current
|
||||
directory, resolves the dependencies, and installs them into `vendor`.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
of `apt-get` or similar package managers.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar update vendor/package vendor/package2
|
||||
```
|
||||
|
||||
You can also use wildcards to update a bunch of packages at once:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
composer.json you can use `--with` and provide a custom version constraint:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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`,
|
||||
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.*
|
||||
```
|
||||
|
||||
|
@ -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 current directory. If no file exists one will be created on the fly.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar require
|
||||
```
|
||||
|
||||
|
@ -247,7 +247,7 @@ installed or updated.
|
|||
If you do not want to choose requirements interactively, you can pass them
|
||||
to the command.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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 current directory.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
the installation type using --prefer-install.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar reinstall acme/foo acme/bar
|
||||
```
|
||||
|
||||
You can specify more than one package name to reinstall, or use a
|
||||
wildcard to select several packages at once:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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`
|
||||
environment variable, you can get its location with the following command :
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar global config bin-dir --absolute
|
||||
```
|
||||
|
||||
If you wish to update the binary later on you can run a global update:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
to search for.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar show
|
||||
```
|
||||
|
||||
To filter the list you can pass a package mask using wildcards.
|
||||
|
||||
```sh
|
||||
php composer.phar show monolog/*
|
||||
|
||||
monolog/monolog 1.19.0 Sends your logs to files, sockets, inboxes, databases and various web services
|
||||
```shell
|
||||
php composer.phar show "monolog/*"
|
||||
```
|
||||
```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
|
||||
name.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar show monolog/monolog
|
||||
|
||||
```
|
||||
```text
|
||||
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
|
||||
names : monolog/monolog
|
||||
source : [git] https://github.com/Seldaek/monolog.git 3d4e60d0cbc4b888fe5ad223d77964428b1978da
|
||||
dist : [zip] https://github.com/Seldaek/monolog/zipball/3d4e60d0cbc4b888fe5ad223d77964428b1978da 3d4e60d0cbc4b888fe5ad223d77964428b1978da
|
||||
license : MIT
|
||||
license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
|
||||
homepage : http://github.com/Seldaek/monolog
|
||||
source : [git] https://github.com/Seldaek/monolog.git 904713c5929655dc9b97288b69cfeedad610c9a1
|
||||
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
|
||||
psr-0
|
||||
Monolog : src/
|
||||
psr-4
|
||||
Monolog\ => src/Monolog
|
||||
|
||||
requires
|
||||
php >=5.3.0
|
||||
psr/log ~1.0
|
||||
```
|
||||
|
||||
You can even pass the package version, which will tell you the details of that
|
||||
specific version.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
for the root package.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
|
@ -636,16 +648,17 @@ search.
|
|||
Add the `--tree` or `-t` flag to show a recursive tree of why the package is
|
||||
depended upon, for example:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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.*)
|
||||
| `- __root__ (requires aboutyou/app-sdk ^2.6)
|
||||
|- monolog/monolog 1.17.2 (requires psr/log ~1.0)
|
||||
| `- laravel/framework v5.2.16 (requires monolog/monolog ~1.11)
|
||||
| `- __root__ (requires laravel/framework ^5.2)
|
||||
`- symfony/symfony v3.0.2 (requires psr/log ~1.0)
|
||||
`- __root__ (requires symfony/symfony ^3.0)
|
||||
```
|
||||
```text
|
||||
psr/log 1.1.4 Common interface for logging libraries
|
||||
├──composer/composer 2.4.x-dev (requires psr/log ^1.0 || ^2.0 || ^3.0)
|
||||
├──composer/composer dev-main (requires psr/log ^1.0 || ^2.0 || ^3.0)
|
||||
├──composer/xdebug-handler 3.0.3 (requires psr/log ^1 || ^2 || ^3)
|
||||
│ ├──composer/composer 2.4.x-dev (requires composer/xdebug-handler ^2.0.2 || ^3.0.3)
|
||||
│ └──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
|
||||
|
@ -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
|
||||
example:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
whether you can upgrade your server to PHP 8.0:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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)
|
||||
doctrine/instantiator 1.0.5 requires php (>=5.3,<8.0-DEV)
|
||||
```
|
||||
```text
|
||||
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
|
||||
|
@ -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` is valid.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
local changes in any of them.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar status
|
||||
```
|
||||
|
||||
With the `--verbose` option you get some more information about what was
|
||||
changed:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar status -v
|
||||
|
||||
```
|
||||
```text
|
||||
You have changes in the following dependencies:
|
||||
vendor/seld/jsonlint:
|
||||
M README.mdown
|
||||
|
@ -727,20 +745,20 @@ vendor/seld/jsonlint:
|
|||
To update Composer itself to the latest version, run the `self-update`
|
||||
command. It will replace your `composer.phar` with the latest version.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar self-update
|
||||
```
|
||||
|
||||
If you would like to instead update to a specific release specify it:
|
||||
|
||||
```sh
|
||||
php composer.phar self-update 1.0.0-alpha7
|
||||
```shell
|
||||
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)),
|
||||
you may have to run the command with `root` privileges
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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`.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
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
|
||||
```
|
||||
|
||||
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"}'
|
||||
```
|
||||
|
||||
|
@ -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
|
||||
changes to the extra section by using it the following way:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
to edit extra fields as json:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
problems.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
excluded/ignored files.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
[Packagist.org api](https://packagist.org/apidoc#list-security-advisories).
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar audit
|
||||
```
|
||||
|
||||
|
@ -1036,7 +1054,7 @@ php composer.phar audit
|
|||
|
||||
To get more information about a certain command, you can use `help`.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
COMPOSER=composer-other.json php composer.phar install
|
||||
```
|
||||
|
||||
|
|
|
@ -385,8 +385,8 @@ Example:
|
|||
|
||||
```json
|
||||
{
|
||||
"require" : {
|
||||
"php" : ">=7.4",
|
||||
"require": {
|
||||
"php": ">=7.4",
|
||||
"ext-mbstring": "*"
|
||||
}
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ override packages from it.
|
|||
Using JSON object notation is also possible. However, JSON key/value pairs
|
||||
are to be considered unordered so consistent behaviour cannot be guaranteed.
|
||||
|
||||
```json
|
||||
```json
|
||||
{
|
||||
"repositories": {
|
||||
"foo": {
|
||||
|
@ -870,7 +870,7 @@ are to be considered unordered so consistent behaviour cannot be guaranteed.
|
|||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
### 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:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
unzip -l acme-corp-parser-10.3.5.zip
|
||||
|
||||
```
|
||||
```text
|
||||
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.
|
||||
|
||||
For instance, if you have the following directory structure in your repository:
|
||||
```
|
||||
```text
|
||||
...
|
||||
├── apps
|
||||
│ └── my-app
|
||||
│ └── composer.json
|
||||
│ └── my-app
|
||||
│ └── composer.json
|
||||
├── packages
|
||||
│ └── my-package
|
||||
│ └── 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:
|
||||
|
||||
```bash
|
||||
```shell
|
||||
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:
|
||||
|
||||
```
|
||||
```shell
|
||||
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:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
your global `auth.json`, execute:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar config --global home
|
||||
```
|
||||
|
||||
|
@ -117,7 +117,7 @@ Read more about the usage of this environment variable [here](../03-cli.md#compo
|
|||
|
||||
### Command line http-basic
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar config [--global] http-basic.repo.example.org username password
|
||||
```
|
||||
|
||||
|
@ -128,7 +128,7 @@ In the above command, the config key `http-basic.repo.example.org` consists of t
|
|||
|
||||
### Manual http-basic
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar config [--global] repositories composer.unique-name https://username:password@repo.example.org
|
||||
```
|
||||
|
||||
### Manual inline http-basic
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar config [--global] --editor
|
||||
```
|
||||
|
||||
|
@ -179,7 +179,7 @@ php composer.phar config [--global] --editor
|
|||
|
||||
### Command line HTTP Bearer authentication
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar config [--global] bearer.repo.example.org token
|
||||
```
|
||||
|
||||
|
@ -190,7 +190,7 @@ In the above command, the config key `bearer.repo.example.org` consists of two p
|
|||
|
||||
### Manual HTTP Bearer authentication
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar config [--global] --editor --auth
|
||||
```
|
||||
|
||||
|
@ -207,7 +207,7 @@ php composer.phar config [--global] --editor --auth
|
|||
|
||||
### Manual custom token authentication
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar config [--global] --editor
|
||||
```
|
||||
|
||||
|
@ -236,7 +236,7 @@ php composer.phar config [--global] --editor
|
|||
|
||||
### Command line gitlab-oauth
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
{
|
||||
"require" : {
|
||||
"php" : ">=7.4"
|
||||
"require": {
|
||||
"php": ">=7.4"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
@ -231,7 +231,7 @@ and thus installations usually take a lot longer.
|
|||
To enable your satis installation to create downloads for all (Git, Mercurial
|
||||
and Subversion) your packages, add the following to your `satis.json`:
|
||||
|
||||
``` json
|
||||
```json
|
||||
{
|
||||
"archive": {
|
||||
"directory": "dist",
|
||||
|
|
|
@ -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:
|
||||
|
||||
```
|
||||
```neon
|
||||
includes:
|
||||
- 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.
|
||||
To do this, run the following commands:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
php composer.phar validate
|
||||
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:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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
|
||||
of all following scripts in the current terminal environment:
|
||||
|
||||
```
|
||||
```shell
|
||||
export COMPOSER_PROCESS_TIMEOUT=0
|
||||
```
|
||||
|
||||
To disable the timeout of a single script call, you must use the `run-script` composer
|
||||
command and specify the `--timeout` parameter:
|
||||
|
||||
```
|
||||
```shell
|
||||
php composer.phar run-script --timeout=0 test
|
||||
```
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ In this case, the PHP `memory_limit` should be increased.
|
|||
|
||||
To get the current `memory_limit` value, run:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
COMPOSER_MEMORY_LIMIT=-1 composer.phar <...>
|
||||
```
|
||||
|
||||
Or, you can increase the limit with a command-line argument:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
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.
|
||||
|
||||
```sh
|
||||
```shell
|
||||
free -m
|
||||
|
||||
```
|
||||
```text
|
||||
total used free shared buffers cached
|
||||
Mem: 2048 357 1690 0 0 237
|
||||
-/+ buffers/cache: 119 1928
|
||||
|
@ -233,7 +234,7 @@ Swap: 0 0 0
|
|||
|
||||
To enable the swap you can use for example:
|
||||
|
||||
```sh
|
||||
```shell
|
||||
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
|
||||
/sbin/mkswap /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:
|
||||
|
||||
```
|
||||
```text
|
||||
The "https://getcomposer.org/version" file could not be downloaded: failed to
|
||||
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
|
||||
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"
|
||||
```
|
||||
|
||||
|
@ -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:
|
||||
|
||||
```bash
|
||||
```shell
|
||||
networksetup -listallnetworkservices
|
||||
```
|
||||
|
||||
Disable IPv6 on that device (in this case "Wi-Fi"):
|
||||
|
||||
```bash
|
||||
```shell
|
||||
networksetup -setv6off Wi-Fi
|
||||
```
|
||||
|
||||
|
@ -321,7 +322,7 @@ Run Composer ...
|
|||
|
||||
You can enable IPv6 again with:
|
||||
|
||||
```bash
|
||||
```shell
|
||||
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:
|
||||
|
||||
```bash
|
||||
```shell
|
||||
ssh -t git@mygitserver.tld
|
||||
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
|
||||
variable `COMPOSER_POOL_OPTIMIZER` and run the update again like so:
|
||||
|
||||
```bash
|
||||
```shell
|
||||
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
|
||||
repository:*
|
||||
|
||||
```sh
|
||||
```shell
|
||||
~/my-library$ git branch
|
||||
```
|
||||
```text
|
||||
v1
|
||||
v2
|
||||
my-feature
|
||||
another-feature
|
||||
```
|
||||
|
||||
```shell
|
||||
~/my-library$ git tag
|
||||
```
|
||||
```text
|
||||
v1.0
|
||||
v1.0.1
|
||||
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:
|
||||
|
||||
```bash
|
||||
```shell
|
||||
#!/bin/sh
|
||||
|
||||
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.
|
||||
For example:
|
||||
|
||||
```bash
|
||||
```shell
|
||||
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
|
||||
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 update --no-plugins --no-scripts ...
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue