Upload
micah-wood
View
441
Download
2
Tags:
Embed Size (px)
DESCRIPTION
Composer is a command line dependency management tool designed for PHP. Come learn how Composer can help you: - Simplify new project creation - Minimize duplication of code in your project repositories - Quickly install and update plugins and themes in bulk - Manage versioning within your project - Follow best practices when managing code for your projects http://wpscholar.com/wcraleigh2014
Citation preview
Using Composer with WordPress
Micah Wood @wpscholar
wpscholar.com/wcraleigh2014
What is ?
Manages Dependencies
Manages Project Dependencies
Manages Project Dependencies and Versions
Simplifies reusing and sharing of code
Why Use Composer?
Automatic Package Installation
Consistent !Versioning
Bulk Package Updates
Class and File Autoloading
Documentation of Dependencies
Recursive Dependencies
Eliminates !Duplication
Package !Discovery
Installing Composer
Local Install!$ curl -sS https://getcomposer.org/installer | php !
Make install global!$ mv composer.phar /usr/local/bin/composer
$ composer diagnoseCheck system for common errors
How Composer Works
composer.jsonHow you declare your dependencies
composer.lockHow Composer stores
your dependencies
vendor directoryWhere composer installs your packages
Specifying Versions
Exact Version 1.0.2
Range of Versions >=1.0,<2.0
Wildcard Version 1.0.*
Next Significant Release Version ~1.2
Semantic Versioningsemver.org
2.3.1Increment when you make breaking changes
Major Version
2.3.1Increment when you add backwards compatible features
Minor Version
2.3.1Increment when you make backwards compatible bug fixes
Patch Version
Using Composer
$ composer initCreate a new composer.json file
$ composer validateValidate your composer.json file
$ composer installDownloads and installs all dependencies
$ composer updateChecks for and installs package updates
$ composer require packageAdds package to composer.json and installs
$ composer remove packageRemoves package from composer.json and uninstalls
$ composer create-project packageDownloads project and runs `composer install`
$ composer search packageDiscover packages on packagist.org
Using Composer with WordPress
$ composer require johnpbloch/wordpressAdd WordPress as a dependency
$ composer require composer/installersEnables WordPress themes and plugins to be put in their respective directories
Setup WordPress PathsPlaces WordPress and its themes and plugins in their respective directories
$ composer create-project wpscholar/wp-skeletonSetup a new WordPress project
Live Demo