From 0ba3c48ee43ace8f1ff1efb1b8a5700c0b861575 Mon Sep 17 00:00:00 2001 From: Isuru Ranawaka Date: Mon, 29 Oct 2018 04:21:14 +0530 Subject: [PATCH] Updated to include require, update and remove (#20269) Updated the file with composer commands and descriptions of require, update and remove. --- guide/english/php/composer/index.md | 31 ++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/guide/english/php/composer/index.md b/guide/english/php/composer/index.md index fe825409f8..2273c5bcb2 100644 --- a/guide/english/php/composer/index.md +++ b/guide/english/php/composer/index.md @@ -13,13 +13,38 @@ You can then install Composer locally or globally. ### Install Packages -Install packages with `composer install`. Composer will install the packages listed in the `composer.json` file to the vendor/ folder. +Install packages with `composer install`. Composer will install the packages listed in the `composer.json` file to the vendor/ folder. ```shell - composer install +composer install ``` +To install only a specific package, use `composer require `. This will only download and install the latest version available to the selected package. + +If you run this command without a `composer.json` file, composer will automatically create it the before the installation. + +```shell +composer require +``` + +### Updating Packages + +Update packages with `composer update`, Composer will automatically download and install the latest versions of the packages listed in the `composer.json` file to the vendor/ folder. + +```shell +composer update +``` + +To update a single package, use `composer update `. + +### Removing Packages + +Removing is easy as installing packages with composer. Just enter `composer remove ` to uninstall the package from your vendor/ folder. This will automatically update your `composer.json` file. + +```shell +composer remove +``` ### More Information: * The Composer website: getcomposer.org * Composer's GitHub repo: composer/getcomposer -* The popular PHP package repository that Composer uses to search for packages: Packagist \ No newline at end of file +* The popular PHP package repository that Composer uses to search for packages: Packagist