Sometimes, when starting a new Laravel project, you can't use the latest version. For example, when the PHP version on your server is lower than required by Laravel. What to do?
In such situations, you can install an older version of Laravel, with this command:
composer create-project --prefer-dist laravel/laravel:^8.0 demo
It will install Laravel version
8.x into a
demo directory as seen in the screenshot below.
That said, I highly recommend starting on the latest version, whenever possible. Otherwise, you're already putting yourself behind, so won't be able to use the latest Laravel features or learn from the latest tutorials. Later it would be even harder to upgrade.
Also, don't forget that older versions don't get any new features and might not even get security fixes soon after you deploy your project. For all Laravel releases, bug fixes are provided for 18 months, and security fixes are provided for 2 years.
If you want to check which PHP version is supported by which Laravel version, you can go to the Support Policy page.
At the time of writing this article, Laravel 10 is the latest version, requiring a minimum of PHP 8.1.
Also, if you want to check which PHP versions are officially supported at the moment, go to this page on PHP.net.
At the time of writing this article, PHP 8.2 is the latest version, with PHP 8.0 receiving security fixes only, and PHP 7.x is officially not supported anymore.
Finally, if you want to know more about composer features besides
composer create-project, I have a premium post: Composer in Laravel: 9 Useful Features.
No comments or questions yet...