When trying to update the Laravel installer using Composer, a content length mismatch exception may occur. This error is because the composer repository key for the packagist has changed from “packagist” (prior to composer V1.2.3) to “packagist.org”:

Solution to this error, just change the composer default repo url:
- composer config -g repo.packagist composer https://packagist.org
- composer config -g github-protocols https ssh
Capture details below for the above command:

Or
D:\XAMPP\htdocs>composer global require laravel/installer
Changed current directory to C:/Users/danny/AppData/Roaming/Composer
Content-Length mismatch, received 372 bytes out of the expected 291742
http://repo.packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
^CTerminate batch job (Y/N)? y
D:\XAMPP\htdocs>composer config -g repo.packagist composer https://packagist.org
D:\XAMPP\htdocs>composer config -g github-protocols https ssh
D:\XAMPP\htdocs>composer global require laravel/installer
Changed current directory to C:/Users/danny/AppData/Roaming/Composer
Using version ^4.0 for laravel/installer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Updating laravel/installer (v3.0.1 => v4.0.3): Downloading (100%)
Writing lock file
Generating autoload files