SlideShare a Scribd company logo
Introduction to Composer
for Drupal
Drupal Camp Japan in Tokyoとは 2017
About me
Luc Bezier, Drupal & Open Source freelance.
France 出身です.
Drupal development since 2010.
URL: webizat.com
Organizer of Drupalcamp Cebu (Philippines)
Worked with BBC Worldwide, UK Government agency,
Ben&Jerry’s, European commission …
Solution Architect & Consultant
Architecture and drupal development
on large projects.
Promet Source and Composer + Drupal
Using Drupal with Composer since 2014.
Drupal 7, Drupal 8.
What is Composer?
Dependency Manager for PHP.
Declare the libraries of your project
and Composer will manage
(install/update) them for you.
これはいくらですか?
How much does it cost?
Composer is Free and Open source.
By Nils Adermann and Jordi Boggiano in 2012.
Not only Drupal, used in other PHP projects like
Symfony.
BTW, the logo?
Could this man be a composer too,
but what he is doing is conducting.
Why using Composer?
Never miss a dependency again.
Clear view on your project’s requirements.
Smaller amount of data in your git repo.
Makes maintenance easier.
Why using Composer?
Drupal 8 adopted Composer.
Contributed modules are using composer to
manage their PHP depencencies.
Composer commands
$ composer install
Creates a resource (vendor) folder and downloads all
dependencies.
$ composer update
Updates the dependencies according to composer.json.
Composer commands
$ composer require
Adds a new dependency.
$ composer remove
Removes a dependency.
Composer commands
Debugging?
$ composer install -vvv
Verbose mode will let you see what is composer doing.
Composer’s files
Simply remember
composer.json: list of dependencies for the project.
composer.lock: expected install state.
composer.json
…
"require": {
"drupal/core": "~8.0",
"drush/drush": "^8.1",
"drupal/console": "~0.10",
"drupal/field_group": "~8.1@alpha",
"drupal/honeypot": "^8.1",
"drupal/google_analytics": "^8.2",
"drupal/avatars": "^8.1@beta"
},
...
composer.json
Composer.json uses versions.
"drupal/core": "~8.0",
~8.0 is equivalent to >=8.0 <9.0
The ~ will keep our version as Drupal 8.
Doc: https://getcomposer.org/doc/articles/versions.md
composer.lock
The file composer.lock contains all informations about
your dependencies, including which exact version is in
use.
"name": "drupal/core",
"version": "8.1.10",
"source": {
"type": "git",
"url": "https://github.com/drupal-composer/drupal-core.git",
"reference": "9562f733cdefd735337bf827b3ba5ad031aba4c3"
},
Composer and git
Commit composer.json and composer.lock
Do not commit the vendor folder. It would defeat the
purpose of using composer to manage your
dependencies.
Composer for Drupal
Drupal 8 tarball from drupal.org ships with a
composer.json and composer.lock files.
Better way: composer templates.
Composer for Drupal
Two templates to use composer with Drupal.
drupal/drupal
drupal-composer/drupal-project
(https://www.drupal.org/node/2718229)
Composer for Drupal
I recommend the drupal-composer template.
Quick installation via:
$ composer create-project drupal-composer/drupal-project
https://github.com/drupal-composer/drupal-project
Composer for Drupal
Using the template for Drupal projects, files used by
Drupal (such as modules) will be placed at the right
location.
Core -> web/core
Contrib modules -> web/modules/contrib
Contrib themes -> web/themes/contrib
No composer template Drupal Composer template
web
Example, the core folder is not in git.
Composer for Drupal
Need a new module?
$ composer require drupal/pathauto
Enable the module.
Composer for Drupal
Update all dependencies (can be slow).
$ composer update
Update Drupal core.
$ composer update drupal/core --with-dependencies
Update a module.
$ composer update drupal/panels --with-dependencies
Composer for Drupal
Patches?
Use composer-patches
https://github.com/cweagans/composer-patches
"extra": {
"patches": {
"drupal/date": {
"7.2.9": [
{
"title": "Fix an issue with undefined index: show_remaining_days in
date_field_formatter_view()",
"url":
"https://www.drupal.org/files/issues/date-show_remaining_days_notice-2469189-1.patch"
}
]
},
},
}
Warning, this is the sad part.
Composer is slow.
助けて!
Composer performance
Composer is slow.
Composer will check all the available tags when
updating a dependency for example.
The more dependencies, the slower. That can be an
issue with some Drupal projects.
Composer performance
Update specific packages, not everything.
$ composer update drupal/panels --with-dependencies
Not
$ composer update
Composer performance
You are using Vagrant?
Execute composer from your local, not the VM.
You are using Docker?
Execute composer from your local, not the container.
When possible, use the latest version of PHP to
execute composer.
PHP 7 (https://secure.php.net/releases/)
Composer performance
Other solutions (I haven’t tried)?
Local mirror of the packages using Satis*
getcomposer.org/doc/articles/handling-private-packages-with-satis.md
Parallel download with prestissimo**
github.com/hirak/prestissimo
* Thanks to Johnnie Fox for sharing.
** Thanks Koyama Tetsuji for sharing.
Composer performance
Most Drupal Platform as a Service (PaaS)
(Acquia, Pantheon ...) do not yet support composer.
Check the documentation.
Composer and Drupal
My blog article
webizat.com/blog/composer-for-drupal
(feel free to comment!)
Composer and Drupal
Great article by Matt Glaman
https://glamanate.com/blog/managing-your-drupal-pr
oject-composer
Useful links and resources:
https://github.com/drupal-composer/drupal-project
https://github.com/cweagans/composer-patches
Test it with Expresso PHP
Docker for PHP developers
Simple and easy to understand. Original images only.
Nginx + PHP (7 / 5)
Apache + PHP (7 / 5)
github.com/expresso-php/expresso-php
ありがとう
Twitter @luukyb
email: luc [at] webizat.com
web: webizat.com
Ad

More Related Content

What's hot (20)

Upgrading your site from Drupal 6 to Drupal 7
Upgrading your site from Drupal 6 to Drupal 7Upgrading your site from Drupal 6 to Drupal 7
Upgrading your site from Drupal 6 to Drupal 7
Andrew Martha
 
Drupalcampatl d7
Drupalcampatl d7Drupalcampatl d7
Drupalcampatl d7
Mediacurrent
 
[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party
DrupalDay
 
Introduction to Module Development (Drupal 7)
Introduction to Module Development (Drupal 7)Introduction to Module Development (Drupal 7)
Introduction to Module Development (Drupal 7)
April Sides
 
Drupal
DrupalDrupal
Drupal
Rightway Solution (I) Pvt. Ltd
 
Drupal Developer Days Keynote
Drupal Developer Days KeynoteDrupal Developer Days Keynote
Drupal Developer Days Keynote
Angela Byron
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
Nuvole
 
Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!
Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!
Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!
DrupalCamp Kyiv
 
COSA SIGNIFICA CONVERTIRE UN MODULO DA D7 A D8
COSA SIGNIFICA CONVERTIRE UN MODULO DA D7 A D8COSA SIGNIFICA CONVERTIRE UN MODULO DA D7 A D8
COSA SIGNIFICA CONVERTIRE UN MODULO DA D7 A D8
Roberto Peruzzo
 
Are you ready for Drupal 8?
Are you ready for Drupal 8?Are you ready for Drupal 8?
Are you ready for Drupal 8?
Stephanie Peugh
 
大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング
大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング
大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング
Yoshikazu Aoyama
 
Water Torture Upgrades - Drupal 5 to 6
Water Torture Upgrades - Drupal 5 to 6Water Torture Upgrades - Drupal 5 to 6
Water Torture Upgrades - Drupal 5 to 6
Angus Pratt
 
Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8
Pantheon
 
CakePHP: An Introduction
CakePHP: An IntroductionCakePHP: An Introduction
CakePHP: An Introduction
Diana Jayne Gonzales
 
The Flexibility of Drupal 8 | DCNLights 2017
The Flexibility of Drupal 8 | DCNLights 2017The Flexibility of Drupal 8 | DCNLights 2017
The Flexibility of Drupal 8 | DCNLights 2017
Michael Miles
 
Drupal Migrations in 2018
Drupal Migrations in 2018Drupal Migrations in 2018
Drupal Migrations in 2018
Pantheon
 
Drupal 8 CMI on a Managed Workflow
Drupal 8 CMI on a Managed WorkflowDrupal 8 CMI on a Managed Workflow
Drupal 8 CMI on a Managed Workflow
Pantheon
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupal
drubb
 
Headless Drupal
Headless DrupalHeadless Drupal
Headless Drupal
drubb
 
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Zyxware Technologies
 
Upgrading your site from Drupal 6 to Drupal 7
Upgrading your site from Drupal 6 to Drupal 7Upgrading your site from Drupal 6 to Drupal 7
Upgrading your site from Drupal 6 to Drupal 7
Andrew Martha
 
[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party
DrupalDay
 
Introduction to Module Development (Drupal 7)
Introduction to Module Development (Drupal 7)Introduction to Module Development (Drupal 7)
Introduction to Module Development (Drupal 7)
April Sides
 
Drupal Developer Days Keynote
Drupal Developer Days KeynoteDrupal Developer Days Keynote
Drupal Developer Days Keynote
Angela Byron
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
Nuvole
 
Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!
Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!
Migration from Drupal 7 to Drupal 8 - How Docker can save our lives!
DrupalCamp Kyiv
 
COSA SIGNIFICA CONVERTIRE UN MODULO DA D7 A D8
COSA SIGNIFICA CONVERTIRE UN MODULO DA D7 A D8COSA SIGNIFICA CONVERTIRE UN MODULO DA D7 A D8
COSA SIGNIFICA CONVERTIRE UN MODULO DA D7 A D8
Roberto Peruzzo
 
Are you ready for Drupal 8?
Are you ready for Drupal 8?Are you ready for Drupal 8?
Are you ready for Drupal 8?
Stephanie Peugh
 
大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング
大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング
大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング
Yoshikazu Aoyama
 
Water Torture Upgrades - Drupal 5 to 6
Water Torture Upgrades - Drupal 5 to 6Water Torture Upgrades - Drupal 5 to 6
Water Torture Upgrades - Drupal 5 to 6
Angus Pratt
 
Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8
Pantheon
 
The Flexibility of Drupal 8 | DCNLights 2017
The Flexibility of Drupal 8 | DCNLights 2017The Flexibility of Drupal 8 | DCNLights 2017
The Flexibility of Drupal 8 | DCNLights 2017
Michael Miles
 
Drupal Migrations in 2018
Drupal Migrations in 2018Drupal Migrations in 2018
Drupal Migrations in 2018
Pantheon
 
Drupal 8 CMI on a Managed Workflow
Drupal 8 CMI on a Managed WorkflowDrupal 8 CMI on a Managed Workflow
Drupal 8 CMI on a Managed Workflow
Pantheon
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupal
drubb
 
Headless Drupal
Headless DrupalHeadless Drupal
Headless Drupal
drubb
 
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Introduction to Drupal, Training conducted at MES-AIMAT, Aluva on 2013-09-26
Zyxware Technologies
 

Similar to Introduction to Composer for Drupal (20)

Managing your Drupal project with Composer
Managing your Drupal project with ComposerManaging your Drupal project with Composer
Managing your Drupal project with Composer
Matt Glaman
 
Composer is the new Drush - Drupal Developer Training (internal)
Composer is the new Drush - Drupal Developer Training (internal)Composer is the new Drush - Drupal Developer Training (internal)
Composer is the new Drush - Drupal Developer Training (internal)
Exove
 
Composer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalComposer Tools & Frameworks for Drupal
Composer Tools & Frameworks for Drupal
Pantheon
 
Composer tools and frameworks for drupal.ppt
Composer tools and frameworks for drupal.pptComposer tools and frameworks for drupal.ppt
Composer tools and frameworks for drupal.ppt
Promet Source
 
Composer tools and frameworks for Drupal
Composer tools and frameworks for DrupalComposer tools and frameworks for Drupal
Composer tools and frameworks for Drupal
Promet Source
 
Composer JSON kills make files
Composer JSON kills make filesComposer JSON kills make files
Composer JSON kills make files
ropsu
 
Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and Drush
Pantheon
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
nuppla
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
nuppla
 
Exploring composer in drupal 8 with drupal project - salva molina
Exploring composer in drupal 8 with drupal project - salva molinaExploring composer in drupal 8 with drupal project - salva molina
Exploring composer in drupal 8 with drupal project - salva molina
Salvador Molina (Slv_)
 
Drupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflowDrupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflow
valuebound
 
Drupal + composer = new love !?
Drupal + composer = new love !?Drupal + composer = new love !?
Drupal + composer = new love !?
nuppla
 
Composer
ComposerComposer
Composer
Zaib Un Nisa
 
Drupal 8 improvements for developer productivity php symfony and more
Drupal 8 improvements for developer productivity  php symfony and moreDrupal 8 improvements for developer productivity  php symfony and more
Drupal 8 improvements for developer productivity php symfony and more
Acquia
 
How to migrate SourcePro apps from Solaris to Linux
How to migrate SourcePro apps from Solaris to LinuxHow to migrate SourcePro apps from Solaris to Linux
How to migrate SourcePro apps from Solaris to Linux
Rogue Wave Software
 
Docman - The swiss army knife for Drupal multisite docroot management and dep...
Docman - The swiss army knife for Drupal multisite docroot management and dep...Docman - The swiss army knife for Drupal multisite docroot management and dep...
Docman - The swiss army knife for Drupal multisite docroot management and dep...
Aleksey Tkachenko
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with docker
Maciej Lukianski
 
Android presentation - Gradle ++
Android presentation - Gradle ++Android presentation - Gradle ++
Android presentation - Gradle ++
Javier de Pedro López
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
Pantheon
 
Drupal 8 preview_slideshow
Drupal 8 preview_slideshowDrupal 8 preview_slideshow
Drupal 8 preview_slideshow
Tee Malapela
 
Managing your Drupal project with Composer
Managing your Drupal project with ComposerManaging your Drupal project with Composer
Managing your Drupal project with Composer
Matt Glaman
 
Composer is the new Drush - Drupal Developer Training (internal)
Composer is the new Drush - Drupal Developer Training (internal)Composer is the new Drush - Drupal Developer Training (internal)
Composer is the new Drush - Drupal Developer Training (internal)
Exove
 
Composer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalComposer Tools & Frameworks for Drupal
Composer Tools & Frameworks for Drupal
Pantheon
 
Composer tools and frameworks for drupal.ppt
Composer tools and frameworks for drupal.pptComposer tools and frameworks for drupal.ppt
Composer tools and frameworks for drupal.ppt
Promet Source
 
Composer tools and frameworks for Drupal
Composer tools and frameworks for DrupalComposer tools and frameworks for Drupal
Composer tools and frameworks for Drupal
Promet Source
 
Composer JSON kills make files
Composer JSON kills make filesComposer JSON kills make files
Composer JSON kills make files
ropsu
 
Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and Drush
Pantheon
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
nuppla
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
nuppla
 
Exploring composer in drupal 8 with drupal project - salva molina
Exploring composer in drupal 8 with drupal project - salva molinaExploring composer in drupal 8 with drupal project - salva molina
Exploring composer in drupal 8 with drupal project - salva molina
Salvador Molina (Slv_)
 
Drupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflowDrupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflow
valuebound
 
Drupal + composer = new love !?
Drupal + composer = new love !?Drupal + composer = new love !?
Drupal + composer = new love !?
nuppla
 
Drupal 8 improvements for developer productivity php symfony and more
Drupal 8 improvements for developer productivity  php symfony and moreDrupal 8 improvements for developer productivity  php symfony and more
Drupal 8 improvements for developer productivity php symfony and more
Acquia
 
How to migrate SourcePro apps from Solaris to Linux
How to migrate SourcePro apps from Solaris to LinuxHow to migrate SourcePro apps from Solaris to Linux
How to migrate SourcePro apps from Solaris to Linux
Rogue Wave Software
 
Docman - The swiss army knife for Drupal multisite docroot management and dep...
Docman - The swiss army knife for Drupal multisite docroot management and dep...Docman - The swiss army knife for Drupal multisite docroot management and dep...
Docman - The swiss army knife for Drupal multisite docroot management and dep...
Aleksey Tkachenko
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with docker
Maciej Lukianski
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
Pantheon
 
Drupal 8 preview_slideshow
Drupal 8 preview_slideshowDrupal 8 preview_slideshow
Drupal 8 preview_slideshow
Tee Malapela
 
Ad

More from Luc Bézier (8)

Quick guide to Freedom and travels for developers
Quick guide to Freedom and travels for developersQuick guide to Freedom and travels for developers
Quick guide to Freedom and travels for developers
Luc Bézier
 
Guide to freedom and travels for developers
Guide to freedom and travels for developersGuide to freedom and travels for developers
Guide to freedom and travels for developers
Luc Bézier
 
The Future of Offices
The Future of OfficesThe Future of Offices
The Future of Offices
Luc Bézier
 
Drupal for beginners - Global Training Days - Cebu 2016
Drupal for beginners - Global Training Days - Cebu 2016Drupal for beginners - Global Training Days - Cebu 2016
Drupal for beginners - Global Training Days - Cebu 2016
Luc Bézier
 
Made with drupal 8
Made with drupal 8Made with drupal 8
Made with drupal 8
Luc Bézier
 
Open Source Software, community matters
Open Source Software, community mattersOpen Source Software, community matters
Open Source Software, community matters
Luc Bézier
 
Data migration to Drupal using the migrate module
Data migration to Drupal using the migrate moduleData migration to Drupal using the migrate module
Data migration to Drupal using the migrate module
Luc Bézier
 
Drupal ladder Cebu : Learn to contribute | November 2013
Drupal ladder Cebu : Learn to contribute | November 2013Drupal ladder Cebu : Learn to contribute | November 2013
Drupal ladder Cebu : Learn to contribute | November 2013
Luc Bézier
 
Quick guide to Freedom and travels for developers
Quick guide to Freedom and travels for developersQuick guide to Freedom and travels for developers
Quick guide to Freedom and travels for developers
Luc Bézier
 
Guide to freedom and travels for developers
Guide to freedom and travels for developersGuide to freedom and travels for developers
Guide to freedom and travels for developers
Luc Bézier
 
The Future of Offices
The Future of OfficesThe Future of Offices
The Future of Offices
Luc Bézier
 
Drupal for beginners - Global Training Days - Cebu 2016
Drupal for beginners - Global Training Days - Cebu 2016Drupal for beginners - Global Training Days - Cebu 2016
Drupal for beginners - Global Training Days - Cebu 2016
Luc Bézier
 
Made with drupal 8
Made with drupal 8Made with drupal 8
Made with drupal 8
Luc Bézier
 
Open Source Software, community matters
Open Source Software, community mattersOpen Source Software, community matters
Open Source Software, community matters
Luc Bézier
 
Data migration to Drupal using the migrate module
Data migration to Drupal using the migrate moduleData migration to Drupal using the migrate module
Data migration to Drupal using the migrate module
Luc Bézier
 
Drupal ladder Cebu : Learn to contribute | November 2013
Drupal ladder Cebu : Learn to contribute | November 2013Drupal ladder Cebu : Learn to contribute | November 2013
Drupal ladder Cebu : Learn to contribute | November 2013
Luc Bézier
 
Ad

Recently uploaded (20)

Vaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without HallucinationsVaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without Hallucinations
john409870
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Top 10 IT Help Desk Outsourcing Services
Top 10 IT Help Desk Outsourcing ServicesTop 10 IT Help Desk Outsourcing Services
Top 10 IT Help Desk Outsourcing Services
Infrassist Technologies Pvt. Ltd.
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Mastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdfMastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdf
Spiral Mantra
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Build 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHSBuild 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHS
TECH EHS Solution
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 
Vaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without HallucinationsVaibhav Gupta BAML: AI work flows without Hallucinations
Vaibhav Gupta BAML: AI work flows without Hallucinations
john409870
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Mastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdfMastering Advance Window Functions in SQL.pdf
Mastering Advance Window Functions in SQL.pdf
Spiral Mantra
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Build 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHSBuild 3D Animated Safety Induction - Tech EHS
Build 3D Animated Safety Induction - Tech EHS
TECH EHS Solution
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Unlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive GuideUnlocking the Power of IVR: A Comprehensive Guide
Unlocking the Power of IVR: A Comprehensive Guide
vikasascentbpo
 

Introduction to Composer for Drupal

  • 1. Introduction to Composer for Drupal Drupal Camp Japan in Tokyoとは 2017
  • 2. About me Luc Bezier, Drupal & Open Source freelance. France 出身です. Drupal development since 2010. URL: webizat.com Organizer of Drupalcamp Cebu (Philippines) Worked with BBC Worldwide, UK Government agency, Ben&Jerry’s, European commission …
  • 3. Solution Architect & Consultant Architecture and drupal development on large projects.
  • 4. Promet Source and Composer + Drupal Using Drupal with Composer since 2014. Drupal 7, Drupal 8.
  • 5. What is Composer? Dependency Manager for PHP. Declare the libraries of your project and Composer will manage (install/update) them for you.
  • 6. これはいくらですか? How much does it cost? Composer is Free and Open source. By Nils Adermann and Jordi Boggiano in 2012. Not only Drupal, used in other PHP projects like Symfony.
  • 7. BTW, the logo? Could this man be a composer too, but what he is doing is conducting.
  • 8. Why using Composer? Never miss a dependency again. Clear view on your project’s requirements. Smaller amount of data in your git repo. Makes maintenance easier.
  • 9. Why using Composer? Drupal 8 adopted Composer. Contributed modules are using composer to manage their PHP depencencies.
  • 10. Composer commands $ composer install Creates a resource (vendor) folder and downloads all dependencies. $ composer update Updates the dependencies according to composer.json.
  • 11. Composer commands $ composer require Adds a new dependency. $ composer remove Removes a dependency.
  • 12. Composer commands Debugging? $ composer install -vvv Verbose mode will let you see what is composer doing.
  • 13. Composer’s files Simply remember composer.json: list of dependencies for the project. composer.lock: expected install state.
  • 14. composer.json … "require": { "drupal/core": "~8.0", "drush/drush": "^8.1", "drupal/console": "~0.10", "drupal/field_group": "~8.1@alpha", "drupal/honeypot": "^8.1", "drupal/google_analytics": "^8.2", "drupal/avatars": "^8.1@beta" }, ...
  • 15. composer.json Composer.json uses versions. "drupal/core": "~8.0", ~8.0 is equivalent to >=8.0 <9.0 The ~ will keep our version as Drupal 8. Doc: https://getcomposer.org/doc/articles/versions.md
  • 16. composer.lock The file composer.lock contains all informations about your dependencies, including which exact version is in use. "name": "drupal/core", "version": "8.1.10", "source": { "type": "git", "url": "https://github.com/drupal-composer/drupal-core.git", "reference": "9562f733cdefd735337bf827b3ba5ad031aba4c3" },
  • 17. Composer and git Commit composer.json and composer.lock Do not commit the vendor folder. It would defeat the purpose of using composer to manage your dependencies.
  • 18. Composer for Drupal Drupal 8 tarball from drupal.org ships with a composer.json and composer.lock files. Better way: composer templates.
  • 19. Composer for Drupal Two templates to use composer with Drupal. drupal/drupal drupal-composer/drupal-project (https://www.drupal.org/node/2718229)
  • 20. Composer for Drupal I recommend the drupal-composer template. Quick installation via: $ composer create-project drupal-composer/drupal-project https://github.com/drupal-composer/drupal-project
  • 21. Composer for Drupal Using the template for Drupal projects, files used by Drupal (such as modules) will be placed at the right location. Core -> web/core Contrib modules -> web/modules/contrib Contrib themes -> web/themes/contrib
  • 22. No composer template Drupal Composer template web Example, the core folder is not in git.
  • 23. Composer for Drupal Need a new module? $ composer require drupal/pathauto Enable the module.
  • 24. Composer for Drupal Update all dependencies (can be slow). $ composer update Update Drupal core. $ composer update drupal/core --with-dependencies Update a module. $ composer update drupal/panels --with-dependencies
  • 25. Composer for Drupal Patches? Use composer-patches https://github.com/cweagans/composer-patches "extra": { "patches": { "drupal/date": { "7.2.9": [ { "title": "Fix an issue with undefined index: show_remaining_days in date_field_formatter_view()", "url": "https://www.drupal.org/files/issues/date-show_remaining_days_notice-2469189-1.patch" } ] }, }, }
  • 26. Warning, this is the sad part.
  • 28. Composer performance Composer is slow. Composer will check all the available tags when updating a dependency for example. The more dependencies, the slower. That can be an issue with some Drupal projects.
  • 29. Composer performance Update specific packages, not everything. $ composer update drupal/panels --with-dependencies Not $ composer update
  • 30. Composer performance You are using Vagrant? Execute composer from your local, not the VM. You are using Docker? Execute composer from your local, not the container. When possible, use the latest version of PHP to execute composer. PHP 7 (https://secure.php.net/releases/)
  • 31. Composer performance Other solutions (I haven’t tried)? Local mirror of the packages using Satis* getcomposer.org/doc/articles/handling-private-packages-with-satis.md Parallel download with prestissimo** github.com/hirak/prestissimo * Thanks to Johnnie Fox for sharing. ** Thanks Koyama Tetsuji for sharing.
  • 32. Composer performance Most Drupal Platform as a Service (PaaS) (Acquia, Pantheon ...) do not yet support composer. Check the documentation.
  • 33. Composer and Drupal My blog article webizat.com/blog/composer-for-drupal (feel free to comment!)
  • 34. Composer and Drupal Great article by Matt Glaman https://glamanate.com/blog/managing-your-drupal-pr oject-composer Useful links and resources: https://github.com/drupal-composer/drupal-project https://github.com/cweagans/composer-patches
  • 35. Test it with Expresso PHP Docker for PHP developers Simple and easy to understand. Original images only. Nginx + PHP (7 / 5) Apache + PHP (7 / 5) github.com/expresso-php/expresso-php
  • 36. ありがとう Twitter @luukyb email: luc [at] webizat.com web: webizat.com