Installing Laravel with Composer create-project - how to use the newest version?

Viewed 2831

It has been a while since I created a new project with Laravel framework. Decided to install a fresh project so opened up V7 documentation at Install Via Composer Create-Project.

First updated my global Composer installation to the newest version: composer self-update

Then ran installation with composer create-project as exampled in the docs: composer create-project --prefer-dist laravel/laravel myproject

After installation went into the directory to check Laravel's version: cd myproject && php laravel -V

Much to my surprise it had installed a much older version: Laravel Framework 5.8.37

Expected to get the newest version... Why did it install an older version, and how do I upgrade or instruct the create-project command to use the newest version?

1 Answers

It looks lile your environment is insufficient for L7 (like too old PHP version, missing required extensions etc). You should ensure your environment fulfills Laravel requirements:

  • PHP >= 7.2.5
  • BCMath PHP Extension
  • Ctype PHP Extension
  • Fileinfo PHP extension
  • JSON PHP Extension
  • Mbstring PHP Extension
  • OpenSSL PHP Extension
  • PDO PHP Extension Tokenizer PHP Extension XML PHP Extension

https://laravel.com/docs/7.x/installation#server-requirements

Also keep in mind that php-cli version you use may be different from what your httpd is using (i. e. due to $PATH and multiple PHP versions are installed).

Related