How to install lower version of laravel? - laravel

trying to install new laravel app I got version error :
$ laravel new hostels3
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for mockery/mockery 1.4.1 -> satisfiable by mockery/mockery[1.4.1].
- mockery/mockery 1.4.1 requires php ^7.3 || ^8.0 -> your PHP version (7.2.24) does not satisfy that requirement.
I do not want to move to PHP 7.3 now and if there isa a way to install lower version of laravel
to satisfy my PHP version 7.2.24 ? If yes, how ?
Thanks!

Laravel installer needs PHP 7.3, You may use composer instead:
composer create-project --prefer-dist laravel/laravel hostels3
Note 1: Laravel framework v7.x needs PHP version 7.2.5 or greater. You have 7.2.24 so you can install Laravel 7.x (the latest as of writing).
Note 2: To install older version of Laravel, specify the version as the last argument:
composer create-project --prefer-dist laravel/laravel hostels3 "6.*"

that way you can choose the version to install
composer create-project laravel/laravel miproyecto "6.*"

using composer you can simply install, Below I show laravel 5.4 install using composer
composer create-project --prefer-dist laravel/laravel blog "5.4.*"

Related

How can I install Laravel 9.4.1 version?

I want to install Laravel 9.4.1 in my system but it is installing 9.3.0 automatically when I write this command:
composer create-project laravel/laravel newproject
I have am using PHP 8.1.6.
You must use the following command:
composer create-project --prefer-dist laravel/laravel:^9.3.8 <your_name_project>
the latest version is 9.3.8
Laravel 9.4.1 version has not been released, so it's wise not to install.
composer create-project laravel/laravel newproject
This command automatically installs a supported project using the Laravel framework, and this command:
composer create-project laravel/laravel:^9.3.8 your-project-name
Installs the 9.3.8 Laravel LTS version.

laravel new blog not work mockery/mockery 1.4.0

Today I wanted to create a new project with Laravel with this command
laravel new blog
But I get this error
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for mockery/mockery 1.4.0 -> satisfiable by mockery/mockery[1.4.0].
- mockery/mockery 1.4.0 requires php ^7.3.0 -> your PHP version (7.2.23) does not satisfy that requirement.
Why should php7.3 be read when Laravel himself says at least php7.2.5 ???
Run composer update.
The reason:
Your PHP version is too low. You've got 7.2.23 installed, and mockery/mockery 1.4 requires 7.3.0
The best solution is to upgrade your PHP version. Alternatively, you can reduce mockery's version to 1.3.1, which only requires PHP 5.6 or above.
My bug report can be found here
As of 2020-05-21, the zip files that laravel new ___ uses will try to install mockery/mockery version 1.4. This won't work with versions of PHP below 7.3. In order to fix this, run composer update, and mockery will be downgraded to a compatible version.
I had the same problem today for new Laravel projects. The composer.json file was showing "mockery/mockery": "^1.3.1" but still was showing the same error. Delete also the composer.lock file and run composer install.
Assuming you are trying to create a new laravel project called blog this is what I did to fix the error after running laravel new blog
cd into blog
run composer update
Create a .env file. You can just make a copy of .env.example and rename the copy to .env. In case you try to start the dev server using php artisan serve and the app launches with a 500 error, run these commands:
php artisan key:generate
php artisan cache:clear
php artisan config:clear
composer dump-autoload
I had the problem when trying to create new Laravel applications,I updated php version using the following commands and it worked.
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt install -y php7.4 php7.4-gd php7.4-mbstring php7.4-xml
Delete the composer.lock file and run composer again
composer install
You can just run
composer create-project --prefer-dist laravel/laravel <project_name>
It'll automatically fall-back to mockery^1.3.1
I also faced these problems.
Problem 1
- Installation request for facade/ignition-contracts 1.0.2 -> satisfiable by facade/ignition-contracts[1.0.2].
- facade/ignition-contracts 1.0.2 requires php ^7.3|^8.0 -> your PHP version (7.2.34) does not satisfy that requirement.
Problem 2
- Installation request for mockery/mockery 1.4.2 -> satisfiable by mockery/mockery[1.4.2].
- mockery/mockery 1.4.2 requires php ^7.3 || ^8.0 -> your PHP version (7.2.34) does not satisfy that requirement.
Problem 3
- facade/ignition-contracts 1.0.2 requires php ^7.3|^8.0 -> your PHP version (7.2.34) does not satisfy that requirement.
- nunomaduro/collision v4.2.0 requires facade/ignition-contracts ^1.0 -> satisfiable by facade/ignition-contracts[1.0.2].
- Installation request for nunomaduro/collision v4.2.0 -> satisfiable by nunomaduro/collision[v4.2.0].
I had deleted the composer.lock file and executed composer install command.
My problem solved.
This might be stale, the issue here is that the php needs to be updated to version that will be compatible.
delete the composer.lock file and autoload file in vendor i.e vendor/autoload in your project
upgrade php version from php.net
run composer install --no scripts
run composer update
php artisan migrate
php artisan key:generate

Laravel installer not installing latest version

I have attempted installing Laravel 5.7 with the Laravel installed and composer create-project but both install 5.6.34
I have specified the 5.7.0 and dev-develop branch in my composer command. When I specify 5.7.0 I get the following exception:
Could not find package laravel/laravel with version 5.7.*
When I specify dev-develop it installs 5.6.34 - I assume 5.7 has been released as it is available on the Laravel website with upgrade instructions.
Anyone know what's happening here?
Laravel 5.7 is not officially released yet, but you can get the latest commit from github master branch like this:
composer create-project laravel/laravel:dev-master myproject --dev

How to install Laravel 4 using composer

When laravel 5 is not yet released, I install Laravel 4 using this command composer create-project laravel/laravel your-project-name --prefer-dist. But now when I use it, It installs laravel 5. I just want to use laravel 4, not yet ready for 5.
I've tried the other answers but doesn't work for me. So here's the command I use.
composer create-project laravel/laravel=4.1.27 your-project-name --prefer-dist
Source :
Installing specific laravel version with composer create-project
UPDATE
Laravel updated the installation docs of 4.* after releasing 5.
composer create-project laravel/laravel {directory} 4.2 --prefer-dist
Source: http://laravel.com/docs/4.2#install-laravel
If nothing specified composer create-project will get the latest stable version. You can change that by just specifying the version you want:
composer create-project laravel/laravel project-name ~4.2.0 --prefer-dist
This will install the latest 4.2.* version of laravel
You should download latest laravel 4.2 release from github - https://github.com/laravel/laravel/releases/tag/v4.2.11
then use composer update to download all relevant packages including latest laravel version
I use Alternate Method.
Docs says Alternate Method
Once Composer is installed, download the 4.2 version https://github.com/laravel/laravel/archive/v4.2.11.zip of the Laravel framework and extract its contents into a directory on your server. Next, in the root of your Laravel application, run the php composer.phar install (or composer install) command to install all of the framework's dependencies. This process requires Git to be installed on the server to successfully complete the installation.
If you want to update the Laravel framework, you may issue the php composer.phar update command.
U can use this
composer create-project laravel/laravel {directory} 4.2 --prefer-dist
replacing {directory} with the actual directory of your project

Install Older Version of Laravel using Composer

How do I install older version of Laravel framework using composer? The current version is 4.1 and I want to install Laravel 4.0.
either update your composer.json to what GregD mentioned or fetch it directly with
composer create-project laravel/laravel your-project-name 4.0.*
prefer this, as there can be some caveats when getting version 4.1 and wanting to downgrade (or even upgrade).
Finally it works, I just did four things:
composer create-project laravel/laravel mobilebanking 4.0
Change "dev" to "stable" in composer.json
Then run
composer self-update
After that, run this command
composer update --no-scripts
composer create–project laravel/laravel MiProyecto 5.3.* o
composer create–project laravel/laravel=5.3.* MiProyecto
Browse packagist - https://packagist.org/packages/laravel/laravel
Find version you need and add it to composer i.e.
"require": {
"laravel/laravel": "v4.0.0",
},
Install it like this:
composer create-project laravel/laravel path/to/your/directory version
For Laravel versions 5.5 it looks like this:
composer create-project laravel/laravel path/to/your/directory 5.5

Resources