Web developer & Open-Source Contributor
composer install
composer install
composer require vendor/package
composer update vendor/package
composer update
composer remove vendor/package
Do NOT manually edit composer.json
composer require --dev phpunit/phpunit
^1.2 (>=1.2.0 <2.0.0)
composer require vendor/package
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/you/package"
}
],
"require": {
"you/package": "^1.0"
}
}
avoid using those!
{
"name": "vendor/package",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}
{
"require": {
"vendor/package": "1.0.*@dev"
}
}
{
"require": {
"vendor/package": "dev-bugfix as 1.0-dev"
}
}
composer <command> -v|vv|vvv
composer show vendor/name
composer outdated
Composer should be the only mean for autoloading classes
{
"autoload": {
"psr-4": { "App\\": "src/" }
},
"autoload-dev": {
"psr-4": { "App\\Tests\\": "tests/" }
}
}
"config": {
"platform": {
"php": "5.6.29"
}
}
Safer alternative for --ignore-platform-reqs
{
"scripts": {
"test": "phpunit",
"cs-fix": "php-cs-fixer fix --rules=@PSR2"
}
}
composer test