SlideShare uma empresa Scribd logo
1 de 32
Managing Your Drupal
Project with Composer
matt glaman | @nmdmatt | mglaman
Matt Glaman
Senior Drupal Consultant @ Commerce Guys
Co-maintainer of Drupal Commerce
Author of Drupal 8 Development Cookbook
http://bit.ly/d8-dev-cookbook
Dependency
Management
It ain't’ new.
PIP
composer
The de facto dependency management tool for PHP
composer.json
defines metadata about the project and dependencies for the project
composer.lock
computed information about dependencies and expected install state
composer install
downloads and installs dependencies
will install off of lock file
if no lock file, acts as update
composer update
updates defined dependencies
rebuilds the lock file
generates autoloader
composer require
adds a new dependency, updates the JSON and .lock file.
updates autoloader
composer remove
removes a dependency, updates the JSON and .lock file
updates autoloader
New to Drupal
Drupal never had dependency management.
Drush kind of helped.
Still a little rocky
Installing Drupal
Install from packaged archive
Drupal.org has a packaging system which
provides zip and tar archives.
These archives come with all third party
dependencies downloaded.
Install via Composer template
composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
Creates your project in some-dir
Contains vendor and web directory
Follows current standard application structure
https://github.com/drupal-composer/drupal-project
Adding dependencies to Drupal
Without Composer (or any tools.)
With Composer
composer require drupal/panels
"require": {
"drupal/panels": "3.0-beta4",
}
Use Composer require command to add the dependency
Your composer.json should have the following
BUT WAIT. There’s currently a catch….
Drupal.org Composer Façade
https://packages.drupal.org/8
Repository endpoints provide packages
Drupal.org provides a repository endpoint (beta)
Allows Drupal.org projects to be installed via composer
Allows Drupal.org projects to specify 3rd party libraries
Initial community initative: https://github.com/drupal-composer
Adding the endpoint to composer.json
composer config repositories.drupal composer https://packages.drupal.org/8
Your composer.json will now have
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
}
},
Version
constraints
~8.2.1: >=8.2.1 <8.3.0
~8.2: >=8.2 <9.0.0
^8.2.1: >=8.2.1 <9.0.0
8.2.0: specifically 8.2.0
Same as everyone else.
semver ftw.
https://blog.madewithlove.be/post/tilde-and-caret-constraints/
https://semver.mwl.be/#?package=drupal%2Fdrupal
Core: 8.2.0, 8.2.1, 8.2.2, 8.3.0-rc1, etc.
Contrib: 8.x-2.0 == 8.2.0, 8.x-2.10 == 8.2.10
Updating dependencies
Without Composer (or any tools.)
With Composer
composer update drupal/panels --with-dependencies
Use Composer update command
--with-dependencies
allows all of the package’s dependencies to be updated
Alternatively, could just run composer update for all the things
Updating Drupal Core
Without Composer (manually)
1. Download latest 8.x.x archive
2. Remove your core and vendor directories
3. Make note of changes to .htaccess, composer.json, or robots.txt.
4. Apply archive contents to site
5. Re-apply changes to .htaccess, composer.json, or robots.txt.
6. Run update.php
https://www.drupal.org/docs/8/update/update-procedure-in-drupal-8
With Composer
Modify the shipped composer.json and move drupal/core to a requirement.
"require": {
"composer/installers": "^1.0.21",
"wikimedia/composer-merge-plugin": "~1.3",
"drupal/core": "~8.2"
},
"replace": { },
run composer update drupal/core --with-dependencies and have an up to date Drupal.
With Composer project template
composer update drupal/core --with-dependencies
PATCHES!
Using patch files with Composer
Require cweagans/composer-patches as a dependency
It is a Composer plugin
Specify patches in the extra definition
Applies patches on update and install
"extra": {
"patches": {
"drupal/commerce”: {
"#2805625 Drupal.org": "https://www.drupal.org/files/issues/add_a_new_service_to-2805625-4.patch",
"#2805625: GitHub": "https://github.com/drupalcommerce/commerce/pull/511.patch"
}
}
}
Resources
Managing Your Drupal Project with Composer
https://glamanate.com/blog/managing-your-drupal-project-composer
Drupal Composer project template
https://github.com/drupal-composer/drupal-project
Drupal Commerce project template
https://github.com/drupalcommerce/project-base
Platform.sh Drupal 8 + Composer template example
https://github.com/platformsh/platformsh-example-drupal/tree/8.x
Amazee Labs Composer recipes (examples of what we covered.)
https://www.amazeelabs.com/en/blog/drupalcomposerrecipes

Mais conteúdo relacionado

Mais procurados

Deploying a Pylons app to Google App Engine
Deploying a Pylons app to Google App EngineDeploying a Pylons app to Google App Engine
Deploying a Pylons app to Google App EngineJazkarta, Inc.
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101Rami Sayar
 
[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release partyDrupalDay
 
Approaching package manager
Approaching package managerApproaching package manager
Approaching package managerTimur Safin
 
Composer | PHP Dependency Manager
Composer | PHP Dependency ManagerComposer | PHP Dependency Manager
Composer | PHP Dependency ManagerUjjwal Ojha
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
WordPress modern development
WordPress modern developmentWordPress modern development
WordPress modern developmentRoman Veselý
 
Geek Sync I Working with SQL Server for Linux Cross-Platform
Geek Sync I Working with SQL Server for Linux Cross-PlatformGeek Sync I Working with SQL Server for Linux Cross-Platform
Geek Sync I Working with SQL Server for Linux Cross-PlatformIDERA Software
 
PHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source ProjectPHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source Projectxsist10
 
makefiles tutorial
makefiles tutorialmakefiles tutorial
makefiles tutorialvsubhashini
 
PHP South Coast - Don't code bake, an introduction to CakePHP 3
PHP South Coast - Don't code bake, an introduction to CakePHP 3PHP South Coast - Don't code bake, an introduction to CakePHP 3
PHP South Coast - Don't code bake, an introduction to CakePHP 3David Yell
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with dockerRuoshi Ling
 
Drupal Version Control & File System Basics
Drupal Version Control & File System BasicsDrupal Version Control & File System Basics
Drupal Version Control & File System BasicsJulia Kulla-Mader
 
Connect sql-using-perl-from-linux
Connect sql-using-perl-from-linuxConnect sql-using-perl-from-linux
Connect sql-using-perl-from-linuxVenkat Raman
 
Makefile
MakefileMakefile
MakefileIonela
 

Mais procurados (20)

Deploying a Pylons app to Google App Engine
Deploying a Pylons app to Google App EngineDeploying a Pylons app to Google App Engine
Deploying a Pylons app to Google App Engine
 
FITC - Node.js 101
FITC - Node.js 101FITC - Node.js 101
FITC - Node.js 101
 
[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party[drupalday2017] - Devel - D8 release party
[drupalday2017] - Devel - D8 release party
 
Approaching package manager
Approaching package managerApproaching package manager
Approaching package manager
 
Composer | PHP Dependency Manager
Composer | PHP Dependency ManagerComposer | PHP Dependency Manager
Composer | PHP Dependency Manager
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
WordPress modern development
WordPress modern developmentWordPress modern development
WordPress modern development
 
Composer
ComposerComposer
Composer
 
Drupal Development Tips
Drupal Development TipsDrupal Development Tips
Drupal Development Tips
 
Geek Sync I Working with SQL Server for Linux Cross-Platform
Geek Sync I Working with SQL Server for Linux Cross-PlatformGeek Sync I Working with SQL Server for Linux Cross-Platform
Geek Sync I Working with SQL Server for Linux Cross-Platform
 
Makefiles Bioinfo
Makefiles BioinfoMakefiles Bioinfo
Makefiles Bioinfo
 
PHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source ProjectPHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source Project
 
Statyczna analiza kodu PHP
Statyczna analiza kodu PHPStatyczna analiza kodu PHP
Statyczna analiza kodu PHP
 
makefiles tutorial
makefiles tutorialmakefiles tutorial
makefiles tutorial
 
PHP South Coast - Don't code bake, an introduction to CakePHP 3
PHP South Coast - Don't code bake, an introduction to CakePHP 3PHP South Coast - Don't code bake, an introduction to CakePHP 3
PHP South Coast - Don't code bake, an introduction to CakePHP 3
 
Docker workshop-3105
Docker workshop-3105Docker workshop-3105
Docker workshop-3105
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with docker
 
Drupal Version Control & File System Basics
Drupal Version Control & File System BasicsDrupal Version Control & File System Basics
Drupal Version Control & File System Basics
 
Connect sql-using-perl-from-linux
Connect sql-using-perl-from-linuxConnect sql-using-perl-from-linux
Connect sql-using-perl-from-linux
 
Makefile
MakefileMakefile
Makefile
 

Destaque

Codes and conventions
Codes and conventionsCodes and conventions
Codes and conventionsrosedalyx
 
meningiomas
meningiomas         meningiomas
meningiomas Teryon
 
The Digital Parent (NJASA's Techspo 2014)
The Digital Parent (NJASA's Techspo 2014)The Digital Parent (NJASA's Techspo 2014)
The Digital Parent (NJASA's Techspo 2014)Alicia Mackall
 
Wwv 檢討會議投影片(中場)
Wwv 檢討會議投影片(中場)Wwv 檢討會議投影片(中場)
Wwv 檢討會議投影片(中場)Wendy Yuchen Sun
 
References expose 2016
References expose 2016References expose 2016
References expose 2016Jean LEDOCQ
 
從北林學院到北林有囍
從北林學院到北林有囍從北林學院到北林有囍
從北林學院到北林有囍Wendy Yuchen Sun
 
Learning Commons Update
Learning Commons UpdateLearning Commons Update
Learning Commons UpdateSheli McHugh
 

Destaque (20)

Codes and conventions
Codes and conventionsCodes and conventions
Codes and conventions
 
Textile History Bed Cover Design Terms: motif, dye & warp
 Textile History  Bed Cover Design Terms:  motif, dye & warp  Textile History  Bed Cover Design Terms:  motif, dye & warp
Textile History Bed Cover Design Terms: motif, dye & warp
 
Fyns maritime klynge 121213
Fyns maritime klynge   121213Fyns maritime klynge   121213
Fyns maritime klynge 121213
 
meningiomas
meningiomas         meningiomas
meningiomas
 
Textile Basics: Weaving Draft Portfolio -JenniferHein Textile Conservation
Textile Basics: Weaving Draft Portfolio -JenniferHein Textile ConservationTextile Basics: Weaving Draft Portfolio -JenniferHein Textile Conservation
Textile Basics: Weaving Draft Portfolio -JenniferHein Textile Conservation
 
Cand.tech i maritim teknologi
Cand.tech i maritim teknologiCand.tech i maritim teknologi
Cand.tech i maritim teknologi
 
Uas denmark unmanned aircraft systems
Uas denmark unmanned aircraft systemsUas denmark unmanned aircraft systems
Uas denmark unmanned aircraft systems
 
The Digital Parent (NJASA's Techspo 2014)
The Digital Parent (NJASA's Techspo 2014)The Digital Parent (NJASA's Techspo 2014)
The Digital Parent (NJASA's Techspo 2014)
 
Art Travel Photos- Mexican Work & Play
Art Travel Photos- Mexican Work & PlayArt Travel Photos- Mexican Work & Play
Art Travel Photos- Mexican Work & Play
 
Evaluation
Evaluation Evaluation
Evaluation
 
Exterior Architectural Design as Art
Exterior Architectural Design as ArtExterior Architectural Design as Art
Exterior Architectural Design as Art
 
Wwv 檢討會議投影片(中場)
Wwv 檢討會議投影片(中場)Wwv 檢討會議投影片(中場)
Wwv 檢討會議投影片(中場)
 
Museum Review - Detroit suburb, Canton Township History Center -JenniferHein ...
Museum Review - Detroit suburb, Canton Township History Center -JenniferHein ...Museum Review - Detroit suburb, Canton Township History Center -JenniferHein ...
Museum Review - Detroit suburb, Canton Township History Center -JenniferHein ...
 
References expose 2016
References expose 2016References expose 2016
References expose 2016
 
從北林學院到北林有囍
從北林學院到北林有囍從北林學院到北林有囍
從北林學院到北林有囍
 
Historic Silk Textile Flags - partially restored components
Historic Silk Textile Flags -  partially restored componentsHistoric Silk Textile Flags -  partially restored components
Historic Silk Textile Flags - partially restored components
 
Textile Fabric Blends or content mixture durability
Textile Fabric Blends or content mixture durabilityTextile Fabric Blends or content mixture durability
Textile Fabric Blends or content mixture durability
 
Learning Commons Update
Learning Commons UpdateLearning Commons Update
Learning Commons Update
 
Museum Pest, Exhibition & Storage Examples From CMC Pacific Islands Collection
Museum Pest, Exhibition & Storage Examples From CMC Pacific Islands CollectionMuseum Pest, Exhibition & Storage Examples From CMC Pacific Islands Collection
Museum Pest, Exhibition & Storage Examples From CMC Pacific Islands Collection
 
2014 Iroquois Regional Historic Society, IMLS-CAP, Watseka, IL
 2014 Iroquois Regional Historic Society, IMLS-CAP, Watseka, IL 2014 Iroquois Regional Historic Society, IMLS-CAP, Watseka, IL
2014 Iroquois Regional Historic Society, IMLS-CAP, Watseka, IL
 

Semelhante a Managing your Drupal project with Composer

Introduction to Composer for Drupal
Introduction to Composer for DrupalIntroduction to Composer for Drupal
Introduction to Composer for DrupalLuc Bézier
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupaldrubb
 
Composer JSON kills make files
Composer JSON kills make filesComposer JSON kills make files
Composer JSON kills make filesropsu
 
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 and frameworks for Drupal
Composer tools and frameworks for DrupalComposer tools and frameworks for Drupal
Composer tools and frameworks for DrupalPromet Source
 
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.pptPromet Source
 
Composer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalComposer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalPantheon
 
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 DrushPantheon
 
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 molinaSalvador Molina (Slv_)
 
Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and DrushPantheon
 
Drupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflowDrupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflowvaluebound
 
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)sparkfabrik
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composernuppla
 
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 moreAcquia
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuis Rodríguez Castromil
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with dockerMaciej Lukianski
 
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?Wong Hoi Sing Edison
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Clark Everetts
 
Docker module 1
Docker module 1Docker module 1
Docker module 1Liang Bo
 

Semelhante a Managing your Drupal project with Composer (20)

Introduction to Composer for Drupal
Introduction to Composer for DrupalIntroduction to Composer for Drupal
Introduction to Composer for Drupal
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupal
 
Composer JSON kills make files
Composer JSON kills make filesComposer JSON kills make files
Composer JSON kills make files
 
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)
 
Composer tools and frameworks for Drupal
Composer tools and frameworks for DrupalComposer tools and frameworks for Drupal
Composer tools and frameworks for Drupal
 
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
 
Composer Tools & Frameworks for Drupal
Composer Tools & Frameworks for DrupalComposer Tools & Frameworks for Drupal
Composer Tools & Frameworks for Drupal
 
Composer
ComposerComposer
Composer
 
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
 
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
 
Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and Drush
 
Drupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflowDrupal 8 - Improving your development workflow
Drupal 8 - Improving your development workflow
 
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
 
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
 
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDaysLuisRodriguezLocalDevEnvironmentsDrupalOpenDays
LuisRodriguezLocalDevEnvironmentsDrupalOpenDays
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with docker
 
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
[HKDUG] #20161210 - BarCamp Hong Kong 2016 - What's News in PHP?
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 

Mais de Matt Glaman

Decoupled Days 2019: Delivering Headless Commerce
Decoupled Days 2019: Delivering Headless CommerceDecoupled Days 2019: Delivering Headless Commerce
Decoupled Days 2019: Delivering Headless CommerceMatt Glaman
 
Drupal 414: Meet Commerce 2.0
Drupal 414: Meet Commerce 2.0Drupal 414: Meet Commerce 2.0
Drupal 414: Meet Commerce 2.0Matt Glaman
 
Rockin' Search Engine Optimization in Drupal
Rockin' Search Engine Optimization in DrupalRockin' Search Engine Optimization in Drupal
Rockin' Search Engine Optimization in DrupalMatt Glaman
 
Rockin Responsive Content with Panels Layouts
Rockin Responsive Content with Panels LayoutsRockin Responsive Content with Panels Layouts
Rockin Responsive Content with Panels LayoutsMatt Glaman
 
Gettin responsive: Using Omega 3 and Omega 4.
Gettin responsive: Using Omega 3 and Omega 4.Gettin responsive: Using Omega 3 and Omega 4.
Gettin responsive: Using Omega 3 and Omega 4.Matt Glaman
 
Breaking down Drupal
Breaking down DrupalBreaking down Drupal
Breaking down DrupalMatt Glaman
 
Welcome to Drupal 262
Welcome to Drupal 262Welcome to Drupal 262
Welcome to Drupal 262Matt Glaman
 

Mais de Matt Glaman (7)

Decoupled Days 2019: Delivering Headless Commerce
Decoupled Days 2019: Delivering Headless CommerceDecoupled Days 2019: Delivering Headless Commerce
Decoupled Days 2019: Delivering Headless Commerce
 
Drupal 414: Meet Commerce 2.0
Drupal 414: Meet Commerce 2.0Drupal 414: Meet Commerce 2.0
Drupal 414: Meet Commerce 2.0
 
Rockin' Search Engine Optimization in Drupal
Rockin' Search Engine Optimization in DrupalRockin' Search Engine Optimization in Drupal
Rockin' Search Engine Optimization in Drupal
 
Rockin Responsive Content with Panels Layouts
Rockin Responsive Content with Panels LayoutsRockin Responsive Content with Panels Layouts
Rockin Responsive Content with Panels Layouts
 
Gettin responsive: Using Omega 3 and Omega 4.
Gettin responsive: Using Omega 3 and Omega 4.Gettin responsive: Using Omega 3 and Omega 4.
Gettin responsive: Using Omega 3 and Omega 4.
 
Breaking down Drupal
Breaking down DrupalBreaking down Drupal
Breaking down Drupal
 
Welcome to Drupal 262
Welcome to Drupal 262Welcome to Drupal 262
Welcome to Drupal 262
 

Último

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 

Último (20)

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

Managing your Drupal project with Composer

  • 1. Managing Your Drupal Project with Composer matt glaman | @nmdmatt | mglaman
  • 2. Matt Glaman Senior Drupal Consultant @ Commerce Guys Co-maintainer of Drupal Commerce Author of Drupal 8 Development Cookbook http://bit.ly/d8-dev-cookbook
  • 4.
  • 5. composer The de facto dependency management tool for PHP
  • 6. composer.json defines metadata about the project and dependencies for the project
  • 7. composer.lock computed information about dependencies and expected install state
  • 8. composer install downloads and installs dependencies will install off of lock file if no lock file, acts as update
  • 9. composer update updates defined dependencies rebuilds the lock file generates autoloader
  • 10. composer require adds a new dependency, updates the JSON and .lock file. updates autoloader
  • 11. composer remove removes a dependency, updates the JSON and .lock file updates autoloader
  • 12.
  • 13. New to Drupal Drupal never had dependency management. Drush kind of helped. Still a little rocky
  • 15. Install from packaged archive Drupal.org has a packaging system which provides zip and tar archives. These archives come with all third party dependencies downloaded.
  • 16. Install via Composer template composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction Creates your project in some-dir Contains vendor and web directory Follows current standard application structure https://github.com/drupal-composer/drupal-project
  • 18. Without Composer (or any tools.)
  • 19. With Composer composer require drupal/panels "require": { "drupal/panels": "3.0-beta4", } Use Composer require command to add the dependency Your composer.json should have the following BUT WAIT. There’s currently a catch….
  • 20. Drupal.org Composer Façade https://packages.drupal.org/8 Repository endpoints provide packages Drupal.org provides a repository endpoint (beta) Allows Drupal.org projects to be installed via composer Allows Drupal.org projects to specify 3rd party libraries Initial community initative: https://github.com/drupal-composer
  • 21. Adding the endpoint to composer.json composer config repositories.drupal composer https://packages.drupal.org/8 Your composer.json will now have "repositories": { "drupal": { "type": "composer", "url": "https://packages.drupal.org/8" } },
  • 22. Version constraints ~8.2.1: >=8.2.1 <8.3.0 ~8.2: >=8.2 <9.0.0 ^8.2.1: >=8.2.1 <9.0.0 8.2.0: specifically 8.2.0 Same as everyone else. semver ftw. https://blog.madewithlove.be/post/tilde-and-caret-constraints/ https://semver.mwl.be/#?package=drupal%2Fdrupal Core: 8.2.0, 8.2.1, 8.2.2, 8.3.0-rc1, etc. Contrib: 8.x-2.0 == 8.2.0, 8.x-2.10 == 8.2.10
  • 24. Without Composer (or any tools.)
  • 25. With Composer composer update drupal/panels --with-dependencies Use Composer update command --with-dependencies allows all of the package’s dependencies to be updated Alternatively, could just run composer update for all the things
  • 27. Without Composer (manually) 1. Download latest 8.x.x archive 2. Remove your core and vendor directories 3. Make note of changes to .htaccess, composer.json, or robots.txt. 4. Apply archive contents to site 5. Re-apply changes to .htaccess, composer.json, or robots.txt. 6. Run update.php https://www.drupal.org/docs/8/update/update-procedure-in-drupal-8
  • 28. With Composer Modify the shipped composer.json and move drupal/core to a requirement. "require": { "composer/installers": "^1.0.21", "wikimedia/composer-merge-plugin": "~1.3", "drupal/core": "~8.2" }, "replace": { }, run composer update drupal/core --with-dependencies and have an up to date Drupal.
  • 29. With Composer project template composer update drupal/core --with-dependencies
  • 31. Using patch files with Composer Require cweagans/composer-patches as a dependency It is a Composer plugin Specify patches in the extra definition Applies patches on update and install "extra": { "patches": { "drupal/commerce”: { "#2805625 Drupal.org": "https://www.drupal.org/files/issues/add_a_new_service_to-2805625-4.patch", "#2805625: GitHub": "https://github.com/drupalcommerce/commerce/pull/511.patch" } } }
  • 32. Resources Managing Your Drupal Project with Composer https://glamanate.com/blog/managing-your-drupal-project-composer Drupal Composer project template https://github.com/drupal-composer/drupal-project Drupal Commerce project template https://github.com/drupalcommerce/project-base Platform.sh Drupal 8 + Composer template example https://github.com/platformsh/platformsh-example-drupal/tree/8.x Amazee Labs Composer recipes (examples of what we covered.) https://www.amazeelabs.com/en/blog/drupalcomposerrecipes

Notas do Editor

  1. Dependency management is not a new concept. NodeJS: npm Frontend JS/CSS: Bower Ruby: Bundler/Gems Python: pip Java: Maven C#/.NET: nuget Go: there’s like 10. https://github.com/golang/go/wiki/PackageManagementTools ObjectiveC: cocoapods
  2. Inspired by npm and bundler Provides a way to easily share and use libraries Not like PEAR - which installed to global includes directory and didn’t use PSR standards for autoloading.
  3. Package information Dependencies Developer dependencies Additional metadata
  4. See Gemfile.lock Contains installable package information Provides a repeatable install across instances
  5. downloads and installs dependencies, builds the class autoloader. If a .lock file is available it will install based off of the metadata. Otherwise it will calculated and resolve the download information for dependencies.
  6. “Drush en -y panels_ipe” thx Drush for downloading and enabling everything. Everything isn’t worked out yet for working with Drupal and Composer
  7. Wanted “hunt and peck” but this was more suitable.
  8. Wanted “hunt and peck” but this was more suitable.