phplaravelcomposer-phpcommand-line-interfaceinstallation

How to update Laravel Installer "laravel/installer" to latest version?


I tried to update my laravel/installer using the command:

composer global update laravel/installer

But it only upgraded its minor version (assuming that it uses Semantic Versioning).

Package operations: 0 installs, 1 update, 0 removals
  - Updating laravel/installer (v2.1.0 => v2.3.0): Downloading (100%)

Then I execute the update command again:

composer global update laravel/installer

But outputs:

Nothing to install or update

I now uses PHP 7.4.4 (cli) obtained using php -v so I assume that it should be able to upgrade to latest which is Laravel Installer 3.0.1.


Solution

  • If running composer global update laravel/installer is not enough to upgrade the the desired version, there might be package dependencies that restricts the upgrade to the latest.

    I do not know if there is a composer option to do that on global scope but the following commands works for me:

    # uninstall the package
    composer global remove laravel/installer
    
    # reinstall
    composer global update
    composer global require laravel/installer
    

    The 1st process outputs the outdated packages dependencies that are removed with the laravel/installer package.

    Then the 2nd process installs the latest laravel/installer with the updates dependencies.

    Laravel documentation does not include how to update the installer package yet.


    Update: Adding Documentation link on how to update a composer package.

    composer require specific version documentation.

    php composer.phar require "vendor/package:2.*" vendor/package2:dev-master

    As we can see, specific version could be supplied after the colon.

    https://getcomposer.org/doc/03-cli.md#require


    Update: Updating global packages would be preferred for including security issues from composer global audit