Nono.MA

How to update Laravel Valet

AUGUST 26, 2022

I had installed an old version of Laravel Valet (2.18.10) on my system, and even when running composer global update, Valet wasn't being updated to the latest available version (3.1.9 at the time of this writing).

In theory, here's how you install and update laravel/valet.

# Install
composer global require laravel/valet

# Update
composer global update

But, as I mentioned above, my Valet installation was stuck at 2.18.10.

I forced composer to upgrade laravel/valet to the latest available version by specifying the ^3.0.0 constrain. (Note that this may lock your Valet version and not update in the future when ^4.0.0 is released.)

composer global require laravel/valet:^3.0.0
# Changed current directory to /Users/nono/.composer
# ./composer.json has been updated
# Running composer update laravel/valet
# Loading composer repositories with package information
# Updating dependencies
# Lock file operations: 0 installs, 1 update, 0 removals
#  - Upgrading laravel/valet (v2.18.10 => v3.1.9)
# Writing lock file
# Installing dependencies from lock file (including require-dev)
# Package operations: 0 installs, 1 update, 0 removals
#  - Upgrading laravel/valet (v2.18.10 => v3.1.9): Extracting archive
# Generating autoload files
# 15 packages you are using are looking for funding.
# Use the `composer fund` command to find out more!

Verify the installed version.

valet --version
# Laravel Valet 3.1.9

Inspecting Composer's global composer.json

You can get the path where your global composer.json is located, which defines your installed dependencies.

composer config data-dir
# /Users/nono/.composer

In that directory, you'll find composer.json.

cat $(composer config data-dir)/composer.json
# {
#     "require": {
#         "laravel/valet": "^3.0.0",
#         "laravel/installer": "^4.1"
#     }
# }

BlogCodeLaravel