Skip to content

Instantly share code, notes, and snippets.

@ZachWatkins
Last active April 17, 2023 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZachWatkins/38fa35d9a604011414eecdb836b034fa to your computer and use it in GitHub Desktop.
Save ZachWatkins/38fa35d9a604011414eecdb836b034fa to your computer and use it in GitHub Desktop.
Composer CLI for PHP

Composer CLI for PHP

This is a list of commands or command sets to perform the given task with PHP's package manager.

Upgrade Composer

composer clearcache
composer selfupdate

Upgrade One Dependency

We will use Laravel as an example. Upgrade Composer first.

Step 1: Update your composer.json file with the version numbers you want to upgrade to. For this example we will update "laravel/framework": "^8.0" to "laravel/framework": "^9.0" and update "nunomaduro/collision": "^5.1" to "nunomaduro/collision": "^6.1".

Do a dry run:

composer update laravel/framework nunomaduro/collision --with-all-dependencies --dry-run

If there are problems, you will see an output which lists Laravel's dependencies which also need to be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment