assistbss
assistbss

Reputation: 537

composer require specific version

I need to use jenssegers/blade package in environments with php 5.6 so I need to use illuminate 5.1 (exactly this version). In vendors/jenssegers/blade/composer.json it requires

"require": {
    "illuminate/view": "^5.1"
},

Executing composer update it downloads latest version of illuminate (5.6.17) that requires php 7+.

Laravel 5.1 works with php >= 5.5.9 and should be the same for illuminate 5.1.

I would like to force the download of illuminate 5.1 so I deleted vendors/lluminate directory and edited vendors/jenssegers/blade/composer.json removing '^' before version:

"require": {
    "illuminate/view": "5.1"
}

But composer update keep downloading:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
- Installing illuminate/contracts (v5.6.17): Loading from cache
- Installing illuminate/support (v5.6.17): Loading from cache
- Installing illuminate/filesystem (v5.6.17): Loading from cache
- Installing illuminate/container (v5.6.17): Loading from cache
- Installing illuminate/events (v5.6.17): Loading from cache
- Installing illuminate/view (v5.6.17): Loading from cache

Upvotes: 0

Views: 9673

Answers (1)

rob006
rob006

Reputation: 22144

If you need a installation for PHP 5.6 you should add this to your composer.json:

"config": {
    "platform": {
        "php": "5.6"
    }
}, 

https://getcomposer.org/doc/06-config.md#platform

If you need to lock to specified version of package, you may also add constraint to your composer.json, but configuring PHP version is usually a better idea.

"require": {
    "illuminate/view": "5.1.*"
},

Upvotes: 2

Related Questions