- AFUP Lyon / Composer, le cercle vertueux des dépendances
AFUP Lyon /
Développements spécifiques, création de site, constitution d'équipes, accompagnement, méthodes agiles...
--prefer-lowest
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
getcomposer.org
{
"name": "symfony/framework-standard-edition",
"require": {
"php": ">=5.3.9",
"symfony/console": "2.8.*",
"symfony/yaml": "2.8.*"
},
"require-dev": {
"phpunit/phpunit": "5.0"
}
}
Prefer lowest versions of dependencies.
Useful for testing minimal versions of requirements, generally used with--prefer-stable.
getcomposer.org
Pour l'histoire :
Introduit par Nicolas Grekas le CTO de Blackfire.io pour aider à fiabiliser les tests sur Symfony.
Exemple avec un build Travis CI:
matrix:
include:
- php: 5.4
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
install:
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction
script:
- composer test
composer.json
ne ment pasreact/http-client: 0.4.*
\o/
En testant avec --prefer-lowest
:
PHP Fatal error: Class 'React\Dns\Resolver\Factory' not found in
/home/travis/build/php-http/react-adapter/src/ReactFactory.php on line 37
composer.json
ment...
{
"name": "php-http/react-adapter",
"require": {
"php": ">=5.4",
...
"react/http-client": "^0.4.8",
"react/dns": "^0.4.1",
"react/stream": "^0.4.3"
}
}