2. About me
● Wolfgang Ziegler
● @the_real_fago auf Twitter
● drupal.org/u/fago
● CEO of drunomics
3. Wolfgang Ziegler // fago
●
More than 10 years of Drupal experience
●
Drupal Core Developer and Maintainer der Entity &
Form Subsysteme
●
Leading force behind the Drupal 8 Entity Field API
improvements
4. Wolfgang Ziegler // fago
Creator and Maintainer of modules like
●
Entity API
●
Rules
●
Profile2
●
Field Collection
13. Using it in a project
git clone branch 8.1.x
https://git.drupal.org/project/drupal.git
cd drupal
composer install
14. What happens?
● Downloads code and puts it into ./vendor
(or somewhere else)
● Generates a class autoloader
● Writes lock file → composer.lock
15. Composer update & locks
● composer update
– Update all the dependencies and write new lock file
● composer install
– Apply what's recorded in the lock file
16. Composer & VCS
● Commit composer.json
● For projects: Commit composer.lock
● For libraries: Commit composer.lock for
tests
● Avoid commit vendor files
17. Versions & Composer
● Semantic: Major, minor & patch versions
● Require versions like 7.3.* to only get bug
fixes
● composer supports many different version
constraints
● Do not specify a concrete version, use the lock
file
18. Versions & Composer
● Semantic: Major, minor & patch versions
● Require versions like 7.3.* to only get bug
fixes
● composer supports many different version
constraints
● Do not specify a concrete version, use the lock
file
19. Composer & Drupal
● getting off the island
● object oriented
● OOP basics are necessary
21. Composer & Drupal 8.1
● ./vendor is gone!
● composer install is your friend!
● Nothing changes for tarballs
22. Prediction
● Most Drupal 8 sites will require composer
● Drupal commerce is going to depend on
composer
● Rules 8.x might do so also
● and more will follow
23. Composer & Drupal Projects
● Composer replaces drush make
● composer install drush make makefile↔
● Support for Drupal modules via:
– https://packagist.drupalcomposer.org/
● Custom repositories
● Extendable via scripts
25. Start a new d8 project
● github.com/drupalcomposer/drupalproject
● composer createproject drupal
composer/drupalproject:8.xdev somedir
stability dev nointeraction
26. What does it do?
● Adds Drupal into the „web“ dir
● Adds folder structure, drush, Drupal console,
…
● Custom projects can add more stuff and/or
customize things
● Requires own packagist/satis
28. Drupal 7
● New project? Check out→
github.com/drupalcomposer/drupal
project
● Existing project? composer_generate→
drupal.org/project/composer_generate
● Or just use it for adding vendors!
29. Adding vendors
● Composer Manager
– Aggregates composer.json of modules
● wikimedia/composer-merge-plugin
– Include composer.json of modules using a wildcard
30. Gotchas
● Prefer „dist“ packages for fast builds
● „composer require“ instead of drush dl +
editing make files
● Patches? cweagans/composer-patches→
or just fork & add your repo
31. Edit your vendors
● Delete vendor files / the module
● composer install prefer
source
32. Update a single module
composer update drupal/module
composer update drupal/module
withdepdendencies
34. Deploy from Git?
● Commit vendor...
● Or just commit vendor on release
● Watch out for packages installed from
source
● Use composer scripts to update Git
35. Deployments
● Add project specific drush
● Use composer scripts or robo
● Requires composer / robo on the server or
added to the repo only