8

Today I try to install specific laravel version with composer create-project laravel/laravel=5.1.8 your-project-name --prefer-dist, because some of the plugins have trouble with version 5.1.9 and above.

However, the installation fail and it says Could not find package laravel/laravel with version 5.1.8. How can I install it with composer?

3 Answers 3

9

you can do:

composer create-project laravel/laravel myproject --prefer-dist v5.1.8

To see available versions, you can visit its packagist page (lower right):

https://packagist.org/packages/laravel/framework

UPDATED:

There is no actually a tag for v5.1.8 for package laravel/laravel, Your issue is the framework(core) of laravel..

What you can do to solve it is to edit your composer.json:

"require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.8"
    },

And do composer update "laravel/framework"

Sign up to request clarification or add additional context in comments.

4 Comments

Your method only create a folder called v5.1.8, but still install the latest version, not version 5.1.8
I have updated my answer. However, you are correct that composer is not able to find the package 5.1.8.. If we look at the tags on Laravel git hub repo, the latest tag was only up to 5.1.4, maybe that is the reason it isn't able to find? because if we try to change the 5.1.8 to 5.1.4, it is able to install..
Thanks a lot for your updated answer. Is the a way to do it with composer create-project?
There is no way. As the composer create-project installs the actual laravel application and not its core.. You will see that if you run composer create-project laravel/laravel --prefer-dist, it has a composer.json file and requires "laravel/framework" (which is the core).. You will need to manually update it if you want a specific version of its core. Just make sure if you install a laravel 5~ application, its "laravel/framework" dependency should also be around version 5~ aswell to avoid compatibility issues..
8

A simple answer i can think of is

composer create-project laravel/laravel <app name> "5.1.*"

Just replace < app name > with your application name and you'll install laravel's 5.1 distribution.

2 Comments

But this won't install a specific laravel 5 version , It will install the latest version of 5.1.
Just specify the exact version of laravel you want to install and it'll install the required version if it exists.
1

Use the following command:

composer create-project laravel/laravel my_project 5.1.8

You can also specify a version and up, for example 5.1 and its patches, like so (recommended):

composer create-project laravel/laravel my_project 5.1.*

4 Comments

Tried with your method but it doesn't work and show the same error message.
@AsimShahzad Could not find package laravel/laravel with version 5.1.8. You may try run the command and you will see the error.
Try this "composer create-project laravel/laravel=5.1.8 your-project-name --prefer-dist"
@AsimShahzad Are you suggesting me to try on the method I have tried as written in the question?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.