SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
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
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
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
 
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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
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
 
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
 
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
 
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
 
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.
 
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
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
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.
 

Kürzlich hochgeladen (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
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
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
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
 
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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
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-...
 
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...
 
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 ...
 
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
 
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
 
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 ...
 
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...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
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...
 

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

Hinweis der Redaktion

  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.