composer init # Create composer.json
composer version # Show version
# Install Composer
composer install # Install dependencies
composer install --dry-run # Test install
# Add Packages
composer require vendor/package # Latest version
composer require vendor/package --dev # Dev dependencies
# Update Packages
composer update # Update all packages
composer update --with-dependencies # Update dependencies
composer update vendor/package # Update specific package
composer update vendor/* # Update all packages from vendor
composer update --lock # Update lock file
# Remove Package
composer remove vendor/package # Remove package
# Update Autoloader
composer dumpautoload -o # Optimized autoloader
# Show Package Info
composer show vendor/package # Show package info
composer show --all vendor/package # Show all package info
# Validate Composer.json
composer validate # Validate composer.json
# Create Project
composer create-project vendor/package folder # Create project
# Scripts
composer run-script script-name # Run script
composer run-script --list # List scripts
# Composer Cache
composer clear-cache # Clear cache
composer clearcache # Clear cache
# Composer Diagnose
composer diagnose # Diagnose composer issues
# Composer Self Update
composer self-update # Update composer
composer self-update --rollback # Rollback composer
# Composer Global
composer global require vendor/package # Install globally
composer global update vendor/package # Update globally
composer global remove vendor/package # Remove globally
composer global show # Show global packages
composer global show --all # Show all global packages
# Composer Config
composer config # Show config
composer config --list # List config
composer config --global # Global config
#Versioning
"require": {
// Exact version to 1.5.4
"vendor/package": "1.5.4",
// Greater or lower bounds
"vendor/package": ">=1.5.0", // Anything above 1.5.0
"vendor/package": "<1.5.0", // Anything below 1.5.0
// Wildcard
"vendor/package": "1.5.*", // >=1.5 <1.6
// Next significant release
"vendor/package": "~1.5", // >=1.5 <2.0.0
"vendor/package": "~1.5.2", // >=1.5.2 <1.6.0
// Next release, major version fixed
"vendor/package": "^1.5.2", // >=1.5.2 <2.0.0
"vendor/package": "^0.5.2", // >=0.5.2 <0.6.0
}