简体   繁体   中英

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

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.*"
},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM