Sometimes, when starting a new Laravel project, you can't use the latest version. For example, what should you do when the PHP version on your server is lower than what Laravel requires?
In such situations, you have several options:
1. Using Composer create-project (recommended):
composer create-project laravel/laravel project-name "8.*"
or you can change the order or add additional options
composer create-project --prefer-dist laravel/laravel:^8.0 project-name
It will install Laravel version 8.x into a project-name directory.
If you want to install a specific minor version of Laravel 8, you can specify it more precisely. For example, to install version 8.0.1, you would use:
composer create-project --prefer-dist laravel/laravel:^8.0.1 project-name
2. Using Laravel installer.
If you already have PHP and Composer installed, you may install the Laravel installer via Composer. First, install the Laravel installer:
composer global require laravel/installer
Then create a new project with a specific version:
laravel new project-name
3. You can also specify the version in an existing project's composer.json:
{ "require": { "laravel/framework": "8.*" } }
Then run:
composer update
That said, I strongly recommend starting on the latest version whenever possible. Otherwise, you're already putting yourself behind, so you won't be able to use the latest Laravel features. Later, it would be even harder to upgrade.
Comments
Post a Comment