From 6aec6ecbfa0335eadf8232c609b21891f0b7e1bc Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Mon, 25 Oct 2021 13:11:35 +0200 Subject: [PATCH 1/2] Use `composer.phar` consistently in the examples --- doc/03-cli.md | 2 +- doc/05-repositories.md | 2 +- .../authentication-for-private-packages.md | 32 +++++++++---------- doc/articles/resolving-merge-conflicts.md | 4 +-- doc/articles/scripts.md | 4 +-- doc/articles/troubleshooting.md | 2 +- ...ow-to-install-untrusted-packages-safely.md | 4 +-- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/03-cli.md b/doc/03-cli.md index d99f47e08..083b29583 100644 --- a/doc/03-cli.md +++ b/doc/03-cli.md @@ -9,7 +9,7 @@ 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 -composer dump +php composer.phar dump ``` calls `composer dump-autoload`. diff --git a/doc/05-repositories.md b/doc/05-repositories.md index f8a68fa30..a9002c27d 100644 --- a/doc/05-repositories.md +++ b/doc/05-repositories.md @@ -750,7 +750,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 -composer config -g repo.packagist false +php composer.phar config -g repo.packagist false ``` ← [Schema](04-schema.md) | [Config](06-config.md) → diff --git a/doc/articles/authentication-for-private-packages.md b/doc/articles/authentication-for-private-packages.md index bbc21ee0d..af5d05ef2 100644 --- a/doc/articles/authentication-for-private-packages.md +++ b/doc/articles/authentication-for-private-packages.md @@ -63,7 +63,7 @@ For all authentication methods it is possible to edit them using the command lin To manually edit it, run: ```sh -composer config --global --editor [--auth] +php composer.phar config --global --editor [--auth] ``` For specific authentication implementations, see their sections; @@ -80,7 +80,7 @@ To fix this you need to open the file in an editor and fix the error. To find th your global `auth.json`, execute: ```sh -composer config --global home +php composer.phar config --global home ``` The folder will contain your global `auth.json` if it exists. @@ -115,13 +115,13 @@ Read more about the usage of this environment variable [here](../03-cli.md#compo ### Command line http-basic ```sh -composer config [--global] http-basic.example.org username password +php composer.phar config [--global] http-basic.example.org username password ``` ### Manual http-basic ```sh -composer config [--global] --editor --auth +php composer.phar config [--global] --editor --auth ``` ```json @@ -147,13 +147,13 @@ If the username e.g. is an email address it needs to be passed as `name%40exampl ### Command line inline http-basic ```sh -composer 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 ```sh -composer config [--global] --editor +php composer.phar config [--global] --editor ``` ```json @@ -172,7 +172,7 @@ composer config [--global] --editor ### Manual custom token authentication ```sh -composer config [--global] --editor +php composer.phar config [--global] --editor ``` ```json @@ -201,13 +201,13 @@ composer config [--global] --editor ### Command line gitlab-oauth ```sh -composer config [--global] gitlab-oauth.example.org token +php composer.phar config [--global] gitlab-oauth.example.org token ``` ### Manual gitlab-oauth ```sh -composer config [--global] --editor --auth +php composer.phar config [--global] --editor --auth ``` ```json @@ -226,18 +226,18 @@ composer config [--global] --editor --auth To create a new access token, go to your [access tokens section on GitLab](https://gitlab.com/-/profile/personal_access_tokens) (or the equivalent URL on your private instance) and create a new token. See also [the GitLab access token documentation](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#creating-a-personal-access-token) for more informations. -When creating a gitlab token manually, make sure it has either the `read_api` or `api` scope. +When creating a gitlab token manually, make sure it has either the `read_api` or `api` scope. ### Command line gitlab-token ```sh -composer config [--global] gitlab-token.example.org token +php composer.phar config [--global] gitlab-token.example.org token ``` ### Manual gitlab-token ```sh -composer config [--global] --editor --auth +php composer.phar config [--global] --editor --auth ``` ```json @@ -256,13 +256,13 @@ Read more about it [here](https://github.com/blog/1509-personal-api-tokens). ### Command line github-oauth ```sh -composer config [--global] github-oauth.github.com token +php composer.phar config [--global] github-oauth.github.com token ``` ### Manual github-oauth ```sh -composer config [--global] --editor --auth +php composer.phar config [--global] --editor --auth ``` ```json @@ -280,13 +280,13 @@ The BitBucket driver uses OAuth to access your private repositories via the BitB ### Command line bitbucket-oauth ```sh -composer config [--global] bitbucket-oauth.bitbucket.org consumer-key consumer-secret +php composer.phar config [--global] bitbucket-oauth.bitbucket.org consumer-key consumer-secret ``` ### Manual bitbucket-oauth ```sh -composer config [--global] --editor --auth +php composer.phar config [--global] --editor --auth ``` ```json diff --git a/doc/articles/resolving-merge-conflicts.md b/doc/articles/resolving-merge-conflicts.md index 2ee30a6d1..6870cfbf3 100644 --- a/doc/articles/resolving-merge-conflicts.md +++ b/doc/articles/resolving-merge-conflicts.md @@ -43,8 +43,8 @@ Before committing, make sure the resulting `composer.json` and `composer.lock` f To do this, run the following commands: ```sh -composer validate -composer install [--dry-run] +php composer.phar validate +php composer.phar install [--dry-run] ``` ## Important considerations diff --git a/doc/articles/scripts.md b/doc/articles/scripts.md index 4a29dd60e..30fa03851 100644 --- a/doc/articles/scripts.md +++ b/doc/articles/scripts.md @@ -193,7 +193,7 @@ objects: If you would like to run the scripts for an event manually, the syntax is: ```sh -composer run-script [--dev] [--no-dev] script +php composer.phar run-script [--dev] [--no-dev] script ``` For example `composer run-script post-install-cmd` will run any @@ -276,7 +276,7 @@ To disable the timeout of a single script call, you must use the `run-script` co command and specify the `--timeout` parameter: ``` -composer run-script --timeout=0 test +php composer.phar run-script --timeout=0 test ``` ## Referencing scripts diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index 669d4ce55..dba9023f7 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -312,7 +312,7 @@ As a workaround, open a SSH connection to your Git host before running Composer: ```bash ssh -t git@mygitserver.tld -composer update +php composer.phar update ``` See also https://github.com/composer/composer/issues/4180 for more information. diff --git a/doc/faqs/how-to-install-untrusted-packages-safely.md b/doc/faqs/how-to-install-untrusted-packages-safely.md index 1b3e9d383..8f19974eb 100644 --- a/doc/faqs/how-to-install-untrusted-packages-safely.md +++ b/doc/faqs/how-to-install-untrusted-packages-safely.md @@ -9,8 +9,8 @@ You can disable plugins and scripts during package installation or updates with syntax so only Composer's code, and no third party code, will execute: ```sh -composer install --no-plugins --no-scripts ... -composer update --no-plugins --no-scripts ... +php composer.phar install --no-plugins --no-scripts ... +php composer.phar update --no-plugins --no-scripts ... ``` The `exec` command will always run third party code as the user which runs `composer`. From bb128c465ca852076bd1bd70a77d7cc6d918d57b Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Mon, 25 Oct 2021 13:11:56 +0200 Subject: [PATCH 2/2] Capitalize Composer in the docs --- doc/03-cli.md | 8 ++++---- doc/04-schema.md | 2 +- doc/05-repositories.md | 6 +++--- doc/06-config.md | 4 ++-- doc/articles/aliases.md | 2 +- doc/articles/handling-private-packages.md | 4 ++-- doc/articles/repository-priorities.md | 4 ++-- doc/articles/resolving-merge-conflicts.md | 4 ++-- doc/articles/troubleshooting.md | 10 +++++----- doc/articles/versions.md | 4 ++-- ...i-commit-the-dependencies-in-my-vendor-directory.md | 4 ++-- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/doc/03-cli.md b/doc/03-cli.md index 083b29583..6722fa8b3 100644 --- a/doc/03-cli.md +++ b/doc/03-cli.md @@ -230,7 +230,7 @@ to the command. php composer.phar require "vendor/package:2.*" vendor/package2:dev-master ``` -If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of matches to require. +If you do not specify a package, Composer will prompt you to search for a package, and given results, provide a list of matches to require. ### Options @@ -694,7 +694,7 @@ If Composer was not installed as a PHAR, this command is not available. ## config -The `config` command allows you to edit composer config settings and repositories +The `config` command allows you to edit Composer config settings and repositories 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`. @@ -907,7 +907,7 @@ runs. ### Options -* **--list (-l):** List the available composer binaries. +* **--list (-l):** List the available Composer binaries. ## diagnose @@ -1043,7 +1043,7 @@ configuration in the project's `composer.json` always wins. ### COMPOSER_HTACCESS_PROTECT Defaults to `1`. If set to `0`, Composer will not create `.htaccess` files in the -composer home, cache, and data directories. +Composer home, cache, and data directories. ### COMPOSER_MEMORY_LIMIT diff --git a/doc/04-schema.md b/doc/04-schema.md index 849e5ee68..dbc02ff24 100644 --- a/doc/04-schema.md +++ b/doc/04-schema.md @@ -791,7 +791,7 @@ The following repository types are supported: * **vcs:** The version control system repository can fetch packages from git, svn, fossil and hg repositories. * **package:** If you depend on a project that does not have any support for - composer whatsoever you can define the package inline using a `package` + Composer whatsoever you can define the package inline using a `package` repository. You basically inline the `composer.json` object. For more information on any of these, see [Repositories](05-repositories.md). diff --git a/doc/05-repositories.md b/doc/05-repositories.md index a9002c27d..2379165bb 100644 --- a/doc/05-repositories.md +++ b/doc/05-repositories.md @@ -186,7 +186,7 @@ The array of versions can also optionally be minified using [composer/metadata-minifier](https://packagist.org/packages/composer/metadata-minifier). If you do that, you should add a `"minified": "composer/2.0"` key at the top level to indicate to Composer it must expand the version -list back into the original data. See +list back into the original data. See https://repo.packagist.org/p2/monolog/monolog.json for an example. Any requested package which does not exist MUST return a 404 status code, @@ -199,7 +199,7 @@ the 404-requests, you can also specify an `"available-packages"` key in `packages.json` which should be an array with all the package names that your repository contain. Alternatively you can specify an `"available-package-patterns"` key which is an array of package name patterns -(with `*` matching any string, e.g. `vendor/*` would make composer look up +(with `*` matching any string, e.g. `vendor/*` would make Composer look up every matching package name in this repository). This field is optional. @@ -411,7 +411,7 @@ attempt to use github's zip files. Please note: * **To let Composer choose which driver to use** the repository type needs to be defined as "vcs" -* **If you already used a private repository**, this means Composer should have cloned it in cache. If you want to install the same package with drivers, remember to launch the command `composer clearcache` followed by the command `composer update` to update composer cache and install the package from dist. +* **If you already used a private repository**, this means Composer should have cloned it in cache. If you want to install the same package with drivers, remember to launch the command `composer clearcache` followed by the command `composer update` to update Composer cache and install the package from dist. #### BitBucket Driver Configuration diff --git a/doc/06-config.md b/doc/06-config.md index dffff2104..96bd1840e 100644 --- a/doc/06-config.md +++ b/doc/06-config.md @@ -257,7 +257,7 @@ If it is `auto` then Composer only installs .bat proxy files when on Windows or set to `full` then both .bat files for Windows and scripts for Unix-based operating systems will be installed for each binary. This is mainly useful if you run Composer inside a linux VM but still want the `.bat` proxies available for use -in the Windows host OS. If set to `symlink` Composer will always symlink even on +in the Windows host OS. If set to `symlink` Composer will always symlink even on Windows/WSL. ## prepend-autoloader @@ -344,7 +344,7 @@ Example: ## htaccess-protect Defaults to `true`. If set to `false`, Composer will not create `.htaccess` files -in the composer home, cache, and data directories. +in the Composer home, cache, and data directories. ## lock diff --git a/doc/articles/aliases.md b/doc/articles/aliases.md index c03ec52f2..193396e06 100644 --- a/doc/articles/aliases.md +++ b/doc/articles/aliases.md @@ -89,7 +89,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: ``` php composer.phar require monolog/monolog:"dev-bugfix as 1.0.x-dev" diff --git a/doc/articles/handling-private-packages.md b/doc/articles/handling-private-packages.md index 6dd0b8ee9..3e3c93bb2 100644 --- a/doc/articles/handling-private-packages.md +++ b/doc/articles/handling-private-packages.md @@ -132,7 +132,7 @@ it, pass the VCS repository URL as an optional argument: ## Usage -In your projects all you need to add now is your own composer repository using +In your projects all you need to add now is your own Composer repository using the `packages.example.org` as URL, then you can require your private packages and everything should work smoothly. You don't need to copy all your repositories in every project anymore. Only that one unique repository that @@ -323,7 +323,7 @@ is set to true. * `providers`: optional, `false` by default, when enabled (`true`) each package will be dumped into a separate include file which will be only - loaded by composer when the package is really required. Speeds up composer + loaded by Composer when the package is really required. Speeds up composer handling for repositories with huge number of packages like f.i. packagist. * `output-dir`: optional, defines where to output the repository files if not provided as an argument when calling the `build` command. diff --git a/doc/articles/repository-priorities.md b/doc/articles/repository-priorities.md index e0053a80b..d87eed6dd 100644 --- a/doc/articles/repository-priorities.md +++ b/doc/articles/repository-priorities.md @@ -16,7 +16,7 @@ Canonical repositories are better for a few reasons: has been found somewhere. It also avoids loading duplicate packages in case the same package is present in several of your repositories. - Security wise, it is safer to treat them canonically as it means that packages you -expect to come from your most important repositories will never be loaded from +expect to come from your most important repositories will never be loaded from another repository instead. Let's say you have a private repository which is not canonical, and you require your private package `foo/bar ^2.0` for example. Now if someone publishes @@ -62,7 +62,7 @@ You can also filter packages which a repository will be able to load, either by selecting which ones you want, or by excluding those you do not want. For example here we want to pick only the package `foo/bar` and all the packages from -`some-vendor/` from this composer repository. +`some-vendor/` from this Composer repository. ```json { diff --git a/doc/articles/resolving-merge-conflicts.md b/doc/articles/resolving-merge-conflicts.md index 6870cfbf3..fe6d1a110 100644 --- a/doc/articles/resolving-merge-conflicts.md +++ b/doc/articles/resolving-merge-conflicts.md @@ -33,9 +33,9 @@ An example where we have two branches: To resolve the conflict when we merge these two branches: - We choose the branch that has the most changes, and accept the `composer.json` and `composer.lock` - files from that branch. In this case, we choose the composer files from branch 2. + files from that branch. In this case, we choose the Composer files from branch 2. - We reapply the changes from the other branch (branch 1). In this case we have to run - ```composer require package/A``` again. + `composer require package/A` again. ## 2. Validating your merged files diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index dba9023f7..0182f9231 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -9,7 +9,7 @@ This is a list of common pitfalls on using Composer, and how to avoid them. 1. When facing any kind of problems using Composer, be sure to **work with the latest version**. See [self-update](../03-cli.md#self-update) for details. - + 2. Before asking anyone, run [`composer diagnose`](../03-cli.md#diagnose) to check for common problems. If it all checks out, proceed to the next steps. @@ -84,7 +84,7 @@ indirectly) back on the root package itself, issues can occur in two cases: ## I have a dependency which contains a "repositories" definition in its composer.json, but it seems to be ignored. The [`repositories`](../04-schema.md#repositories) configuration property is defined as [root-only](../04-schema.md#root-package). It is not inherited. You can read more about the reasons behind this in the "[why can't -composer load repositories recursively?](../faqs/why-can't-composer-load-repositories-recursively.md)" article. +Composer load repositories recursively?](../faqs/why-can't-composer-load-repositories-recursively.md)" article. The simplest work-around to this limitation, is moving or duplicating the `repositories` definition into your root composer.json. @@ -189,7 +189,7 @@ manually create a token using the [procedure documented here](authentication-for Now Composer should install/update without asking for authentication. ## proc_open(): fork failed errors -If composer shows proc_open() fork failed on some commands: +If Composer shows proc_open() fork failed on some commands: `PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): fork failed - Cannot allocate memory' in phar` @@ -216,7 +216,7 @@ You can make a permanent swap file following this [tutorial](https://www.digital ## proc_open(): failed to open stream errors (Windows) -If composer shows proc_open(NUL) errors on Windows: +If Composer shows proc_open(NUL) errors on Windows: `proc_open(NUL): failed to open stream: No such file or directory` @@ -288,7 +288,7 @@ Disable IPv6 on that device (in this case "Wi-Fi"): networksetup -setv6off Wi-Fi ``` -Run composer ... +Run Composer ... You can enable IPv6 again with: diff --git a/doc/articles/versions.md b/doc/articles/versions.md index 47f1f8910..4fd1f40b9 100644 --- a/doc/articles/versions.md +++ b/doc/articles/versions.md @@ -78,7 +78,7 @@ If you want Composer to check out a branch instead of a tag, you need to point i In the above example, if you wanted to check out the `my-feature` branch, you would specify `dev-my-feature` as the version constraint in your `require` clause. This would result in Composer cloning the `my-library` repository into my `vendor` directory and checking out the `my-feature` branch. -When branch names look like versions, we have to clarify for composer that we're trying to check out a branch and not a tag. In the above example, we have two version branches: `v1` and `v2`. To get Composer to check out one of these branches, you must specify a version constraint that looks like this: `v1.x-dev`. The `.x` is an arbitrary string that Composer requires to tell it that we're talking about the `v1` branch and not a `v1` tag (alternatively, you can name the branch `v1.x` instead of `v1`). In the case of a branch with a version-like name (`v1`, in this case), you append `-dev` as a suffix, rather than using `dev-` as a prefix. +When branch names look like versions, we have to clarify for Composer that we're trying to check out a branch and not a tag. In the above example, we have two version branches: `v1` and `v2`. To get Composer to check out one of these branches, you must specify a version constraint that looks like this: `v1.x-dev`. The `.x` is an arbitrary string that Composer requires to tell it that we're talking about the `v1` branch and not a `v1` tag (alternatively, you can name the branch `v1.x` instead of `v1`). In the case of a branch with a version-like name (`v1`, in this case), you append `-dev` as a suffix, rather than using `dev-` as a prefix. ### Stabilities @@ -213,7 +213,7 @@ Examples: To allow various stabilities without enforcing them at the constraint level however, you may use [stability-flags](../04-schema.md#package-links) like -`@` (e.g. `@dev`) to let composer know that a given package +`@` (e.g. `@dev`) to let Composer know that a given package can be installed in a different stability than your default minimum-stability setting. All available stability flags are listed on the minimum-stability section of the [schema page](../04-schema.md#minimum-stability). diff --git a/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md b/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md index 67d4133d4..32552e067 100644 --- a/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md +++ b/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md @@ -26,7 +26,7 @@ If you really feel like you must do this, you have a few options: you can add them to your git repo. You can do that with `rm -rf vendor/**/.git` in ZSH or `find vendor/ -type d -name ".git" -exec rm -rf {} \;` in Bash. But this means you will have to delete those dependencies from disk before - running composer update. + running `composer update`. 4. Add a .gitignore rule (`/vendor/**/.git`) to ignore all the vendor `.git` folders. This approach does not require that you delete dependencies from disk prior to - running a composer update. + running a `composer update`.