SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer
with Drupal and Drush
Stanford DrupalCamp 10 April 2015
Greg Anderson
+ + =
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
What Is Composer?
An Installer A Dependency Manager An Autoloader
{
"require": {
"php": ">=5.4.0",
"symfony/browser-kit": "~2.1",
"symfony/css-selector": "~2.1",
"symfony/dom-crawler": "~2.1",
"guzzlehttp/guzzle": ">=4,<6"
},


}
Evaluate and select <?php
$client = new GuzzleHttpClient();
2
>=4,<6
guzzlehttp/guzzle
5.*
guzzlehttp/guzzle
v5.2.0
guzzlehttp/guzzle
"autoload": {
"psr-4": {
"GuzzleHttp": "src/"
}
},
composer.json
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Why Use Composer?
3
1. Standard
2. Easiest for developers
a. Dependency resolution
b. Code updates
c. Autoloading of classes
3. Composer is being adopted everywhere
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using
Composer
Not Using
Composer
What Projects Are Using Composer?
4

 and many others!
http/guzzle
fabpot/goutteDrupal Modules Drush Extensions
PHP APIs
symfony/yaml
twig/twig
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Installing Drupal 7 with Composer
Can we do this?
?+ =
5
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Composer Parts of the Whole
Composer Packagist composer.json Custom Installer
PHP dependency
management
software.
A software
repository
manager.
A structured file
that defines a
project.
An executable
Composer
component.
Optional.
6
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Parts Needed for Composer + D7
packagist.drupal-composer.org davidbarratt/custom-installer derhasi/composer-preserve-paths
A third-party
repository containing
data on projects from
drupal.org.
Allows composer.json
files to specify where
components get
installed.
Allows nested
installation of
composer libraries
(e.g. Drupal modules
inside of Drupal core).
7
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Semantic Versioning
Drupal Module Version Composer Version
8
7.x-1.5
DRUPAL-x.MODULE.MINOR
7.1.5
MAJOR.MINOR.PATCH
● Versions are converted to semantic versioning before being
published on packagist.drupal-composer.org.
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Comparison with Drush Make
; Drush make file that uses guzzle
; API
api = 2
; Core
core = 7.x
; Drupal project.
projects[drupal][type] = core
projects[drupal][version] = 7.x
projects[drupal][download][type] = git
projects[drupal][download][branch] = 7.x
; Modules
projects[] = composer_manager
projects[] = aws_glacier
projects[] = devel
{
"name": "organization/project",
"description": "Example Drupal composer.json file",
"repositories": [
{
"type": "composer",
"url": "http://packagist.drupal-composer.org/ "
}
],
"require": {
"davidbarratt/custom-installer": "dev-master",
"derhasi/composer-preserve-paths": "0.1.*",
"drupal/drupal": "7.*",
"drupal/composer_vendor": "7.1.*",
"http/guzzle": "~5",
"drupal/devel": "7.1.*",
},
"config": {
"vendor-dir": "htdocs/sites/all/vendor"
},
"extra": {


},
"minimum-stability": "dev",
"prefer-stable": true
}
Drush Make composer.json
9
Repository
and custom
installers, as
previously
explained.
Drupal module
that provides
an autoload
strategy
(next).
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Autoloading in PHP
10
<?php
$client = new GuzzleHttpClient();
"autoload": {
"psr-4": {
"GuzzleHttp": "src/"
}
},
composer.json from guzzlehttp/guzzle
autoload_psr4.php
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
Registers its own autoload class when vendor/autoload.
php is included.
$vendorDir = dirname(dirname(__FILE__));
return array(
'GuzzleHttp' => array($vendorDir . '/guzzlehttp/guzzle/src'),
);
Saves one line of code per class - but it’s a very important line!
Generates class maps when composer install is run
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Adding Composer Support
To make this work, we just need to include
vendor/autoload.php
+ =
11
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Composer Modules for Drupal 7
composer_autoload composer_manager composer_vendor
Searches for
autoload.php files
in every module
directory and loads
them individually.
Searches for
composer.json files
in every module and
dynamically merges
them.
Loads the
autoload.php file in
sites/all/vendor.
12
Fragile Complex
Wins!
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Directory Structure with D7 + Composer
● mydrupalsite.org
○ composer.json
○ composer.lock
○ htdocs
■ sites
● default
○ settings.php
○ files
● all
○ modules
○ vendor
13
We create a new top-level directory
for our project, because composer
cannot manage dependencies in
the same directory as composer.json.
We put the vendor directory in
sites/all/vendor because that is
where the composer_vendor project
expects to find it.
We will put our Drupal root directory in
htdocs.
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
How Do We Place the Vendor Directory?
composer.json
14
{
"require": {


},
"config": {
"vendor-dir": "htdocs/sites/all/vendor"
},


}
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
How Do We Place Modules and Themes?
15
{
"require": {
"davidbarratt/custom-installer": "dev-master",


},
"extra": {
"custom-installer": {
"drupal-module": "htdocs/sites/all/modules/contrib/{$name}/",
"drupal-theme": "htdocs/sites/all/themes/contrib/{$name}/"
},
},


}
composer.json
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Can We Use Installation Profiles?
composer.json
16
{
"require": {
"davidbarratt/custom-installer ": "dev-master",
"drupal/panopoly ": "7.1.*",


},
"extra": {
"custom-installer": {
"drupal-profile": " htdocs/profiles/{$name}/ "
},
},


}
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
How Do We Download Modules?
$ drush dl devel
Project devel (7.x-1.5) downloaded
to sites/all/modules/contrib/devel.
Project devel contains 3 modules:
devel_generate, devel,
devel_node_access.
$ composer require drupal/devel '7.*'
./composer.json has been updated
Loading composer repositories with
package information
Updating dependencies (including
require-dev)
Drush Composer
17
● Drush will select the right module major version, but
composer require must be told which version to use.
● Composer require will update the composer.json file
before installing the module.
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Install a Module from a Private Repository
18
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/your-org/your-module"
}
],
"require": {
"your-org/your-module": "dev-master"
},


} https://knpuniversity.com/screencast/question-answer-day/create-composer-package
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Add a Patch to a Module
19
{
"require": {
"netresearch/composer-patches-plugin": "~1.0"
},
"extra": {
"patches": {
"drupal/features": {
"7.2.2":[
{
"title": "Remove mtime from .info export (added by Drupal 7.33)",
"url": "https://www.drupal.org/files/issues/2381739-features-mtime.patch"
}
]
}
}
},


}
http://cambrico.net/drupal/using-composer-to-build-your-drupal-7-projects
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
How Do We Update a Site?
$ drush pm-update $ composer update
$ drush updatedb
Drush Composer
20
Remember - regardless of how you update your site,
always do it on a copy first. Never update directly on the
production site!
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
How Do We Manage Project Code?
● mydrupalsite.org
○ .git
○ composer.json
○ composer.lock
○ .gitignore
○ htdocs
■ sites
● all
○ modules
■ custom
■ contrib
○ vendor
21
Commit composer.json. and
composer.lock to the repository.
composer.lock only changes when
you run composer update.
Avoid committing composer-managed
directories, such as
sites/all/modules/contrib and
sites/all/vendor.
If you have custom modules, you can
commit them in the custom directory.
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
How Do We Deploy Code?
22
rsyncinstallclone
1 2 3
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Idea - Using Two Repositories
23
clone
installclone
commit
rsync pull
2 3
1
4
5
6
Deploy with git while
maintaining a lean working
repository by writing a short
deploy script.
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Converting an Existing Site
$ drush dl composer_generate
$ drush @site composer-generate > composer.json
$ composer install
# Set up settings.php, copy files

$ drush site-install
24
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Installing Drupal 8 with Composer
Drupal 8 already uses Composer, so
this should be easier, right?
?+ =
25
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
How it is Supposed to Work
26
Why Doesn’t this work? “It’s complicated.”
$ composer create-project drupal/drupal path ~8
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Template composer.json File for Drupal 8
Utilize a custom installer to set install locations
27
{
"require": {
"composer/installers": "^1.0.20",
"drupal/core": "8.0.x-dev",
"drush/drush": "~7",
},
"extra": {
"installer-paths": {
"web/core": ["type:drupal-core"],
"web/modules/contrib/{$name}": ["type:drupal-module"]
},
},


}
drupal/core contains only
the contents of the Drupal 8
core directory. This is called a
“split core”.
https://github.com/webflo/drupal-site-template
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Setting Up Drupal 8 for Composer
● mydrupalsite.org
○ composer.json
○ vendor
○ htdocs
■ sites
■ modules
■ themes
■ autoload.php
■ index.php
■ .htaccess
28
We place the vendor directory in its
standard location in the project
directory, rather than in the core
directory where Drupal 8 expects it.
Copy all of the other regular files from
the Drupal 8 root directory.
We need to modify Drupal’s autoload.
php file to include the autoloader in our
vendor directory.
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Modified autoload.php
autoload.php in our modified site
autoload.php in Drupal 8 root
directory
29
<?php
return require __DIR__ . '/../vendor/autoload.php';
<?php
return require __DIR__ . '/core/vendor/autoload.php';
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
What Does “Hacking Core” Mean?
“Every time you hack core
” by Greg Dunlap (heyrocker) DrupalCon Szeged 2008
If you have to
resolve merge
conflicts when
you update, then
you are hacking
core.
30
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Where Do We Go From Here?
31
https://groups.drupal.org/composer
http://drupal-composer.org/
https://github.com/drupal-composer
https://getcomposer.org/
@greg_1_anderson

Weitere Àhnliche Inhalte

Was ist angesagt?

Ninja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersNinja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersChang W. Doh
 
Drupal 8: frontend development
Drupal 8: frontend developmentDrupal 8: frontend development
Drupal 8: frontend developmentsparkfabrik
 
Configuring Django projects for multiple environments
Configuring Django projects for multiple environmentsConfiguring Django projects for multiple environments
Configuring Django projects for multiple environmentsApptension
 
Composer JSON kills make files
Composer JSON kills make filesComposer JSON kills make files
Composer JSON kills make filesropsu
 
Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)Soshi Nemoto
 
Drupal Console Deep Dive: How to Develop Faster and Smarter on Drupal 8
Drupal Console Deep Dive: How to Develop Faster and Smarter on Drupal 8Drupal Console Deep Dive: How to Develop Faster and Smarter on Drupal 8
Drupal Console Deep Dive: How to Develop Faster and Smarter on Drupal 8Jake Borr
 
Gdg cloud taipei ddt meetup #53 buildpack
Gdg cloud taipei ddt meetup #53 buildpackGdg cloud taipei ddt meetup #53 buildpack
Gdg cloud taipei ddt meetup #53 buildpackKAI CHU CHUNG
 
Improving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLAImproving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLAJesus Manuel Olivas
 
Google App Engine: Basic
Google App Engine: BasicGoogle App Engine: Basic
Google App Engine: BasicKAI CHU CHUNG
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with dockerMaciej Lukianski
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeFrontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeDamien Seguin
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in developmentAdam Culp
 
Modernize Your Drupal Development
Modernize Your Drupal DevelopmentModernize Your Drupal Development
Modernize Your Drupal DevelopmentChris Tankersley
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configurationlutter
 
How a Content Delivery Network Can Help Speed Up Your Website
How a Content Delivery Network Can Help Speed Up Your WebsiteHow a Content Delivery Network Can Help Speed Up Your Website
How a Content Delivery Network Can Help Speed Up Your WebsiteMediacurrent
 
Magento 2 Capistrano Deploy
Magento 2 Capistrano DeployMagento 2 Capistrano Deploy
Magento 2 Capistrano DeployDuke Dao
 
Create a Varnish cluster in Kubernetes for Drupal caching - DrupalCon North A...
Create a Varnish cluster in Kubernetes for Drupal caching - DrupalCon North A...Create a Varnish cluster in Kubernetes for Drupal caching - DrupalCon North A...
Create a Varnish cluster in Kubernetes for Drupal caching - DrupalCon North A...Ovadiah Myrgorod
 
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...KAI CHU CHUNG
 

Was ist angesagt? (20)

Ninja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersNinja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for Beginners
 
Drupal 8: frontend development
Drupal 8: frontend developmentDrupal 8: frontend development
Drupal 8: frontend development
 
Configuring Django projects for multiple environments
Configuring Django projects for multiple environmentsConfiguring Django projects for multiple environments
Configuring Django projects for multiple environments
 
Composer JSON kills make files
Composer JSON kills make filesComposer JSON kills make files
Composer JSON kills make files
 
Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)Big query - Command line tools and Tips - (MOSG)
Big query - Command line tools and Tips - (MOSG)
 
Drupal Console Deep Dive: How to Develop Faster and Smarter on Drupal 8
Drupal Console Deep Dive: How to Develop Faster and Smarter on Drupal 8Drupal Console Deep Dive: How to Develop Faster and Smarter on Drupal 8
Drupal Console Deep Dive: How to Develop Faster and Smarter on Drupal 8
 
Gdg cloud taipei ddt meetup #53 buildpack
Gdg cloud taipei ddt meetup #53 buildpackGdg cloud taipei ddt meetup #53 buildpack
Gdg cloud taipei ddt meetup #53 buildpack
 
Ansible project-deploy
Ansible project-deployAnsible project-deploy
Ansible project-deploy
 
Improving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLAImproving your Drupal 8 development workflow DrupalCampLA
Improving your Drupal 8 development workflow DrupalCampLA
 
Google App Engine: Basic
Google App Engine: BasicGoogle App Engine: Basic
Google App Engine: Basic
 
Super powered Drupal development with docker
Super powered Drupal development with dockerSuper powered Drupal development with docker
Super powered Drupal development with docker
 
Frontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the likeFrontend JS workflow - Gulp 4 and the like
Frontend JS workflow - Gulp 4 and the like
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
Modernize Your Drupal Development
Modernize Your Drupal DevelopmentModernize Your Drupal Development
Modernize Your Drupal Development
 
BPMS1
BPMS1BPMS1
BPMS1
 
Challenges of container configuration
Challenges of container configurationChallenges of container configuration
Challenges of container configuration
 
How a Content Delivery Network Can Help Speed Up Your Website
How a Content Delivery Network Can Help Speed Up Your WebsiteHow a Content Delivery Network Can Help Speed Up Your Website
How a Content Delivery Network Can Help Speed Up Your Website
 
Magento 2 Capistrano Deploy
Magento 2 Capistrano DeployMagento 2 Capistrano Deploy
Magento 2 Capistrano Deploy
 
Create a Varnish cluster in Kubernetes for Drupal caching - DrupalCon North A...
Create a Varnish cluster in Kubernetes for Drupal caching - DrupalCon North A...Create a Varnish cluster in Kubernetes for Drupal caching - DrupalCon North A...
Create a Varnish cluster in Kubernetes for Drupal caching - DrupalCon North A...
 
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
 

Ähnlich wie Using Composer with Drupal 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 molinaSalvador Molina (Slv_)
 
Composer tools and frameworks for Drupal
Composer tools and frameworks for DrupalComposer tools and frameworks for Drupal
Composer tools and frameworks for DrupalPromet Source
 
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
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composernuppla
 
Introduction to Composer for Drupal
Introduction to Composer for DrupalIntroduction to Composer for Drupal
Introduction to Composer for DrupalLuc BĂ©zier
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composernuppla
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis OverviewLeo Lorieri
 
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupalDay
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupaldrubb
 
Drupal + composer = new love !?
Drupal + composer = new love !?Drupal + composer = new love !?
Drupal + composer = new love !?nuppla
 
Welcome aboard the team
Welcome aboard the teamWelcome aboard the team
Welcome aboard the teamRoberto Peruzzo
 
Managing your Drupal project with Composer
Managing your Drupal project with ComposerManaging your Drupal project with Composer
Managing your Drupal project with ComposerMatt Glaman
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfigVijay Shukla
 
What makes me "Grunt"?
What makes me "Grunt"? What makes me "Grunt"?
What makes me "Grunt"? Fabien Doiron
 
Continuous Delivery com Docker, OpenShift e Jenkins
Continuous Delivery com Docker, OpenShift e JenkinsContinuous Delivery com Docker, OpenShift e Jenkins
Continuous Delivery com Docker, OpenShift e JenkinsBruno Padilha
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondNuvole
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsMichael Lange
 
Build drupal project based on drush make
Build drupal project based on drush makeBuild drupal project based on drush make
Build drupal project based on drush makeæ°žćŻč 陈
 
Lightweight Developer Provisioning with Gradle
Lightweight Developer Provisioning with GradleLightweight Developer Provisioning with Gradle
Lightweight Developer Provisioning with GradleQAware GmbH
 
Lightweight Developer Provisioning with Gradle and SEU-as-code
Lightweight Developer Provisioning with Gradle and SEU-as-codeLightweight Developer Provisioning with Gradle and SEU-as-code
Lightweight Developer Provisioning with Gradle and SEU-as-codeMario-Leander Reimer
 

Ähnlich wie Using Composer with Drupal and Drush (20)

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
 
Composer tools and frameworks for Drupal
Composer tools and frameworks for DrupalComposer tools and frameworks for Drupal
Composer tools and frameworks for Drupal
 
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
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
 
Introduction to Composer for Drupal
Introduction to Composer for DrupalIntroduction to Composer for Drupal
Introduction to Composer for Drupal
 
Efficient development workflows with composer
Efficient development workflows with composerEfficient development workflows with composer
Efficient development workflows with composer
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and BeyondDrupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
 
Composer & Drupal
Composer & DrupalComposer & Drupal
Composer & Drupal
 
Drupal + composer = new love !?
Drupal + composer = new love !?Drupal + composer = new love !?
Drupal + composer = new love !?
 
Welcome aboard the team
Welcome aboard the teamWelcome aboard the team
Welcome aboard the team
 
Managing your Drupal project with Composer
Managing your Drupal project with ComposerManaging your Drupal project with Composer
Managing your Drupal project with Composer
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
What makes me "Grunt"?
What makes me "Grunt"? What makes me "Grunt"?
What makes me "Grunt"?
 
Continuous Delivery com Docker, OpenShift e Jenkins
Continuous Delivery com Docker, OpenShift e JenkinsContinuous Delivery com Docker, OpenShift e Jenkins
Continuous Delivery com Docker, OpenShift e Jenkins
 
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyondAutomating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
 
Build drupal project based on drush make
Build drupal project based on drush makeBuild drupal project based on drush make
Build drupal project based on drush make
 
Lightweight Developer Provisioning with Gradle
Lightweight Developer Provisioning with GradleLightweight Developer Provisioning with Gradle
Lightweight Developer Provisioning with Gradle
 
Lightweight Developer Provisioning with Gradle and SEU-as-code
Lightweight Developer Provisioning with Gradle and SEU-as-codeLightweight Developer Provisioning with Gradle and SEU-as-code
Lightweight Developer Provisioning with Gradle and SEU-as-code
 

Mehr von Pantheon

Drupal Migrations in 2018
Drupal Migrations in 2018Drupal Migrations in 2018
Drupal Migrations in 2018Pantheon
 
Architecting Million Dollar Projects
Architecting Million Dollar ProjectsArchitecting Million Dollar Projects
Architecting Million Dollar ProjectsPantheon
 
Streamlined Drupal 8: Site Building Strategies for Tight Deadlines
Streamlined Drupal 8: Site Building Strategies for Tight DeadlinesStreamlined Drupal 8: Site Building Strategies for Tight Deadlines
Streamlined Drupal 8: Site Building Strategies for Tight DeadlinesPantheon
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with DrupalPantheon
 
Defense in Depth: Lessons Learned Securing 200,000 Sites
Defense in Depth: Lessons Learned Securing 200,000 SitesDefense in Depth: Lessons Learned Securing 200,000 Sites
Defense in Depth: Lessons Learned Securing 200,000 SitesPantheon
 
Automate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon ViennaAutomate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon ViennaPantheon
 
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & Fastly
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & FastlySub-Second Pageloads: Beat the Speed of Light with Pantheon & Fastly
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & FastlyPantheon
 
Building a Network of 195 Drupal 8 Sites
Building a Network of 195 Drupal 8 Sites Building a Network of 195 Drupal 8 Sites
Building a Network of 195 Drupal 8 Sites Pantheon
 
Hacking Your Agency Workflow: Treating Your Process Like A Product
Hacking Your Agency Workflow: Treating Your Process Like A ProductHacking Your Agency Workflow: Treating Your Process Like A Product
Hacking Your Agency Workflow: Treating Your Process Like A ProductPantheon
 
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 8Pantheon
 
Development Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesDevelopment Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesPantheon
 
WordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use CasesWordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use CasesPantheon
 
Continuous Integration Is for Teams: Moving past buzzword driven development
Continuous Integration Is for Teams: Moving past buzzword driven development Continuous Integration Is for Teams: Moving past buzzword driven development
Continuous Integration Is for Teams: Moving past buzzword driven development Pantheon
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Pantheon
 
Testing Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade WorkflowTesting Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade WorkflowPantheon
 
Test Coverage for Your WP REST API Project
Test Coverage for Your WP REST API ProjectTest Coverage for Your WP REST API Project
Test Coverage for Your WP REST API ProjectPantheon
 
Drupal 8 and Pantheon
Drupal 8 and PantheonDrupal 8 and Pantheon
Drupal 8 and PantheonPantheon
 
Why Your Site is Slow: Performance Answers for Your Clients
Why Your Site is Slow: Performance Answers for Your ClientsWhy Your Site is Slow: Performance Answers for Your Clients
Why Your Site is Slow: Performance Answers for Your ClientsPantheon
 
Drupal Performance
Drupal Performance Drupal Performance
Drupal Performance Pantheon
 
WP or Drupal (or both): A Framework for Client CMS Decisions
WP or Drupal (or both): A Framework for Client CMS Decisions WP or Drupal (or both): A Framework for Client CMS Decisions
WP or Drupal (or both): A Framework for Client CMS Decisions Pantheon
 

Mehr von Pantheon (20)

Drupal Migrations in 2018
Drupal Migrations in 2018Drupal Migrations in 2018
Drupal Migrations in 2018
 
Architecting Million Dollar Projects
Architecting Million Dollar ProjectsArchitecting Million Dollar Projects
Architecting Million Dollar Projects
 
Streamlined Drupal 8: Site Building Strategies for Tight Deadlines
Streamlined Drupal 8: Site Building Strategies for Tight DeadlinesStreamlined Drupal 8: Site Building Strategies for Tight Deadlines
Streamlined Drupal 8: Site Building Strategies for Tight Deadlines
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with Drupal
 
Defense in Depth: Lessons Learned Securing 200,000 Sites
Defense in Depth: Lessons Learned Securing 200,000 SitesDefense in Depth: Lessons Learned Securing 200,000 Sites
Defense in Depth: Lessons Learned Securing 200,000 Sites
 
Automate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon ViennaAutomate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon Vienna
 
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & Fastly
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & FastlySub-Second Pageloads: Beat the Speed of Light with Pantheon & Fastly
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & Fastly
 
Building a Network of 195 Drupal 8 Sites
Building a Network of 195 Drupal 8 Sites Building a Network of 195 Drupal 8 Sites
Building a Network of 195 Drupal 8 Sites
 
Hacking Your Agency Workflow: Treating Your Process Like A Product
Hacking Your Agency Workflow: Treating Your Process Like A ProductHacking Your Agency Workflow: Treating Your Process Like A Product
Hacking Your Agency Workflow: Treating Your Process Like A Product
 
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
 
Development Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesDevelopment Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP Libraries
 
WordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use CasesWordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use Cases
 
Continuous Integration Is for Teams: Moving past buzzword driven development
Continuous Integration Is for Teams: Moving past buzzword driven development Continuous Integration Is for Teams: Moving past buzzword driven development
Continuous Integration Is for Teams: Moving past buzzword driven development
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
Testing Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade WorkflowTesting Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade Workflow
 
Test Coverage for Your WP REST API Project
Test Coverage for Your WP REST API ProjectTest Coverage for Your WP REST API Project
Test Coverage for Your WP REST API Project
 
Drupal 8 and Pantheon
Drupal 8 and PantheonDrupal 8 and Pantheon
Drupal 8 and Pantheon
 
Why Your Site is Slow: Performance Answers for Your Clients
Why Your Site is Slow: Performance Answers for Your ClientsWhy Your Site is Slow: Performance Answers for Your Clients
Why Your Site is Slow: Performance Answers for Your Clients
 
Drupal Performance
Drupal Performance Drupal Performance
Drupal Performance
 
WP or Drupal (or both): A Framework for Client CMS Decisions
WP or Drupal (or both): A Framework for Client CMS Decisions WP or Drupal (or both): A Framework for Client CMS Decisions
WP or Drupal (or both): A Framework for Client CMS Decisions
 

KĂŒrzlich hochgeladen

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂșjo
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

KĂŒrzlich hochgeladen (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Using Composer with Drupal and Drush

  • 1. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Using Composer with Drupal and Drush Stanford DrupalCamp 10 April 2015 Greg Anderson + + =
  • 2. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush What Is Composer? An Installer A Dependency Manager An Autoloader { "require": { "php": ">=5.4.0", "symfony/browser-kit": "~2.1", "symfony/css-selector": "~2.1", "symfony/dom-crawler": "~2.1", "guzzlehttp/guzzle": ">=4,<6" }, 
 } Evaluate and select <?php $client = new GuzzleHttpClient(); 2 >=4,<6 guzzlehttp/guzzle 5.* guzzlehttp/guzzle v5.2.0 guzzlehttp/guzzle "autoload": { "psr-4": { "GuzzleHttp": "src/" } }, composer.json
  • 3. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Why Use Composer? 3 1. Standard 2. Easiest for developers a. Dependency resolution b. Code updates c. Autoloading of classes 3. Composer is being adopted everywhere
  • 4. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Using Composer Not Using Composer What Projects Are Using Composer? 4 
 and many others! http/guzzle fabpot/goutteDrupal Modules Drush Extensions PHP APIs symfony/yaml twig/twig
  • 5. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Installing Drupal 7 with Composer Can we do this? ?+ = 5
  • 6. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Composer Parts of the Whole Composer Packagist composer.json Custom Installer PHP dependency management software. A software repository manager. A structured file that defines a project. An executable Composer component. Optional. 6
  • 7. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Parts Needed for Composer + D7 packagist.drupal-composer.org davidbarratt/custom-installer derhasi/composer-preserve-paths A third-party repository containing data on projects from drupal.org. Allows composer.json files to specify where components get installed. Allows nested installation of composer libraries (e.g. Drupal modules inside of Drupal core). 7
  • 8. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Semantic Versioning Drupal Module Version Composer Version 8 7.x-1.5 DRUPAL-x.MODULE.MINOR 7.1.5 MAJOR.MINOR.PATCH ● Versions are converted to semantic versioning before being published on packagist.drupal-composer.org.
  • 9. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Comparison with Drush Make ; Drush make file that uses guzzle ; API api = 2 ; Core core = 7.x ; Drupal project. projects[drupal][type] = core projects[drupal][version] = 7.x projects[drupal][download][type] = git projects[drupal][download][branch] = 7.x ; Modules projects[] = composer_manager projects[] = aws_glacier projects[] = devel { "name": "organization/project", "description": "Example Drupal composer.json file", "repositories": [ { "type": "composer", "url": "http://packagist.drupal-composer.org/ " } ], "require": { "davidbarratt/custom-installer": "dev-master", "derhasi/composer-preserve-paths": "0.1.*", "drupal/drupal": "7.*", "drupal/composer_vendor": "7.1.*", "http/guzzle": "~5", "drupal/devel": "7.1.*", }, "config": { "vendor-dir": "htdocs/sites/all/vendor" }, "extra": { 
 }, "minimum-stability": "dev", "prefer-stable": true } Drush Make composer.json 9 Repository and custom installers, as previously explained. Drupal module that provides an autoload strategy (next).
  • 10. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Autoloading in PHP 10 <?php $client = new GuzzleHttpClient(); "autoload": { "psr-4": { "GuzzleHttp": "src/" } }, composer.json from guzzlehttp/guzzle autoload_psr4.php $map = require __DIR__ . '/autoload_psr4.php'; foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } Registers its own autoload class when vendor/autoload. php is included. $vendorDir = dirname(dirname(__FILE__)); return array( 'GuzzleHttp' => array($vendorDir . '/guzzlehttp/guzzle/src'), ); Saves one line of code per class - but it’s a very important line! Generates class maps when composer install is run
  • 11. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Adding Composer Support To make this work, we just need to include vendor/autoload.php + = 11
  • 12. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Composer Modules for Drupal 7 composer_autoload composer_manager composer_vendor Searches for autoload.php files in every module directory and loads them individually. Searches for composer.json files in every module and dynamically merges them. Loads the autoload.php file in sites/all/vendor. 12 Fragile Complex Wins!
  • 13. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Directory Structure with D7 + Composer ● mydrupalsite.org ○ composer.json ○ composer.lock ○ htdocs ■ sites ● default ○ settings.php ○ files ● all ○ modules ○ vendor 13 We create a new top-level directory for our project, because composer cannot manage dependencies in the same directory as composer.json. We put the vendor directory in sites/all/vendor because that is where the composer_vendor project expects to find it. We will put our Drupal root directory in htdocs.
  • 14. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush How Do We Place the Vendor Directory? composer.json 14 { "require": { 
 }, "config": { "vendor-dir": "htdocs/sites/all/vendor" }, 
 }
  • 15. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush How Do We Place Modules and Themes? 15 { "require": { "davidbarratt/custom-installer": "dev-master", 
 }, "extra": { "custom-installer": { "drupal-module": "htdocs/sites/all/modules/contrib/{$name}/", "drupal-theme": "htdocs/sites/all/themes/contrib/{$name}/" }, }, 
 } composer.json
  • 16. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Can We Use Installation Profiles? composer.json 16 { "require": { "davidbarratt/custom-installer ": "dev-master", "drupal/panopoly ": "7.1.*", 
 }, "extra": { "custom-installer": { "drupal-profile": " htdocs/profiles/{$name}/ " }, }, 
 }
  • 17. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush How Do We Download Modules? $ drush dl devel Project devel (7.x-1.5) downloaded to sites/all/modules/contrib/devel. Project devel contains 3 modules: devel_generate, devel, devel_node_access. $ composer require drupal/devel '7.*' ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Drush Composer 17 ● Drush will select the right module major version, but composer require must be told which version to use. ● Composer require will update the composer.json file before installing the module.
  • 18. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Install a Module from a Private Repository 18 { "repositories": [ { "type": "vcs", "url": "https://github.com/your-org/your-module" } ], "require": { "your-org/your-module": "dev-master" }, 
 } https://knpuniversity.com/screencast/question-answer-day/create-composer-package
  • 19. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Add a Patch to a Module 19 { "require": { "netresearch/composer-patches-plugin": "~1.0" }, "extra": { "patches": { "drupal/features": { "7.2.2":[ { "title": "Remove mtime from .info export (added by Drupal 7.33)", "url": "https://www.drupal.org/files/issues/2381739-features-mtime.patch" } ] } } }, 
 } http://cambrico.net/drupal/using-composer-to-build-your-drupal-7-projects
  • 20. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush How Do We Update a Site? $ drush pm-update $ composer update $ drush updatedb Drush Composer 20 Remember - regardless of how you update your site, always do it on a copy first. Never update directly on the production site!
  • 21. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush How Do We Manage Project Code? ● mydrupalsite.org ○ .git ○ composer.json ○ composer.lock ○ .gitignore ○ htdocs ■ sites ● all ○ modules ■ custom ■ contrib ○ vendor 21 Commit composer.json. and composer.lock to the repository. composer.lock only changes when you run composer update. Avoid committing composer-managed directories, such as sites/all/modules/contrib and sites/all/vendor. If you have custom modules, you can commit them in the custom directory.
  • 22. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush How Do We Deploy Code? 22 rsyncinstallclone 1 2 3
  • 23. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Idea - Using Two Repositories 23 clone installclone commit rsync pull 2 3 1 4 5 6 Deploy with git while maintaining a lean working repository by writing a short deploy script.
  • 24. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Converting an Existing Site $ drush dl composer_generate $ drush @site composer-generate > composer.json $ composer install # Set up settings.php, copy files
 $ drush site-install 24
  • 25. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Installing Drupal 8 with Composer Drupal 8 already uses Composer, so this should be easier, right? ?+ = 25
  • 26. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush How it is Supposed to Work 26 Why Doesn’t this work? “It’s complicated.” $ composer create-project drupal/drupal path ~8
  • 27. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Template composer.json File for Drupal 8 Utilize a custom installer to set install locations 27 { "require": { "composer/installers": "^1.0.20", "drupal/core": "8.0.x-dev", "drush/drush": "~7", }, "extra": { "installer-paths": { "web/core": ["type:drupal-core"], "web/modules/contrib/{$name}": ["type:drupal-module"] }, }, 
 } drupal/core contains only the contents of the Drupal 8 core directory. This is called a “split core”. https://github.com/webflo/drupal-site-template
  • 28. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Setting Up Drupal 8 for Composer ● mydrupalsite.org ○ composer.json ○ vendor ○ htdocs ■ sites ■ modules ■ themes ■ autoload.php ■ index.php ■ .htaccess 28 We place the vendor directory in its standard location in the project directory, rather than in the core directory where Drupal 8 expects it. Copy all of the other regular files from the Drupal 8 root directory. We need to modify Drupal’s autoload. php file to include the autoloader in our vendor directory.
  • 29. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Modified autoload.php autoload.php in our modified site autoload.php in Drupal 8 root directory 29 <?php return require __DIR__ . '/../vendor/autoload.php'; <?php return require __DIR__ . '/core/vendor/autoload.php';
  • 30. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush What Does “Hacking Core” Mean? “Every time you hack core
” by Greg Dunlap (heyrocker) DrupalCon Szeged 2008 If you have to resolve merge conflicts when you update, then you are hacking core. 30
  • 31. Using Composer with Drupal and DrushUsing Composer with Drupal and Drush Where Do We Go From Here? 31 https://groups.drupal.org/composer http://drupal-composer.org/ https://github.com/drupal-composer https://getcomposer.org/ @greg_1_anderson