Composer Workflows for Drupal 8 Composer Workflows for
- Slides: 77
Composer Workflows for Drupal 8
Composer Workflows for Drupal 8 Kevin Moll Appnovation Technologies Sr. Developer kmoll @kevinjmoll
Composer Workflows for Drupal 8 Pablo Fabregat Appnovation Technologies Automation Engineer pmatias @darth_pablitt
What we’ll cover today ○ What is Composer ○ Composer commands ○ What are packages ○ Where are packages ○ What do we do with private packages ○ Plugins and useful enhancements for Composer ○ How we work this into our automated build process
Dependency Management in Drupal
History ○ Manually install dependencies ○ Drush commands ○ Drush Make
Composer
Installation https: //getcomposer. org/doc/00 -intro. md
What is Composer?
“Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you” Composer Documentation https: //getcomposer. org/doc/00 -intro. md
Packages
What is a Package?
Packages ○ namespace ○ name ○ composer. json file
{ "name": "symfony/yaml", "type": "library", "description": "Symfony Yaml Component", "keywords": [], "homepage": "https: //symfony. com", "license": "MIT", "authors": [ { "name": "Fabien Potencier", "email": "fabien@symfony. com" }, { "name": "Symfony Community", "homepage": "https: //symfony. com/contributors" } ], "require": { "php": ">=5. 3. 9" }, "autoload": { "psr-4": { "Symfony\Component\Yaml\": "" }, "exclude-from-classmap": [ "/Tests/" ] }, "minimum-stability": "dev", "extra": { "branch-alias": { "dev-master": "2. 8 -dev" } }
Defining Dependencies
Repositories composer require [namespace]/[package]: [version]
Packagist
Packagist ○ PHP Package Repository ○ This is the default composer repository ○ Best place to put packages you wish to share
Repositories
Repositories composer config [options] [setting-key] [setting-value 1]. . . [setting-value. N]
Repositories composer config repositories. hello-universe vcs https: //github. com/kmoll/hello_universe
Drupal Packagist https: //packagist. drupal-composer. org
Drupal. org packages endpoint https: //packages. drupal. org/8
Toran Proxy https: //toranproxy. com/
Toran Proxy ○ Packagist proxy ○ Install on your own servers ○ Add packages not available to public ○ Acts as a redundant backup
Packagist Github Toran Drupal Packagist
Semantic Versioning
major. minor. patch
Semver ○ Allows versions to give developers more information ○ Major version: Backwards capability breaking ○ Minor version: Feature Updates (non-BC breaking) ○ Patch version: Bug fixes
Defining versions in Composer
Version Constraints Exact ○ Example: 1. 0. 2
Version Constraints Range ○ >=1. 0 ○ >= 1. 0 < 2. 0 ○ 1. 0 - 2. 0 (This is inclusive) ○ Equivalent to >=1. 0. 0 <=2. 0. 0
Version Constraints Wildcard ○ 1. 2. * Equivalent to >=1. 2. 0 <1. 3 ○ 1. * Equivalent to >=1. 0. 0 <2. 0
Version Constraints Wildcard ○ * Any and all versions
Do not do this! Do not do do this! Do not this!
Version Constraints Next Significant Release Operators ○ Tilde: Only last specified number can change ~1. 2. 3 Equivalent to >=1. 2. 3 <1. 3. 0 ~1. 3 Equivalent to >=1. 3. 0 <2. 0
Version Constraints Next Significant Release Operators ○ Caret: Similar to Tilde but will always allow non-breaking versions ^1. 2. 3 Equivalent to >=1. 2. 3 <2. 0. 0 ^1. 2 Equivalent to >=1. 2. 0 <2. 0. 0
Version Constraints Stability ○ Defaults to dev ○ Can specify --stable ○ Can specify --dev ○ Default can be listed in composer. json or on command line with ‘minimum-stability’ ○ Can be overridden by each package when specifying the version
"require": { "php": ">=5. 5. 9", "symfony/class-loader": "~2. 8", "symfony/console": "~2. 8", "symfony/dependency-injection": "~2. 8", "symfony/event-dispatcher": "~2. 8", "symfony/http-foundation": "~2. 8", "symfony/http-kernel": "~2. 8", "symfony/routing": "~2. 8", "symfony/serializer": "~2. 8", "symfony/translation": "~2. 8", "symfony/validator": "~2. 8", "symfony/process": "~2. 8", "symfony/polyfill-iconv": "~1. 0", "symfony/yaml": "~2. 8", "twig/twig": "^1. 23. 1", "doctrine/common": "2. 5. *", "doctrine/annotations": "1. 2. *", "guzzlehttp/guzzle": "^6. 2. 1", […] }
Install vs. Update
Install vs. Update Install ○ Install should be considered install/sync. ○ Will look at composer. lock file first ○ If version specified there, it will download that exact versions ○ Will ignore composer. json if entry exists in composer. lock ○ In the absence of composer. lock or an entry in composer. lock will act as update
Install vs. Update ○ Should be considered, get latest based on what I specify in composer. json. ○ Will look at composer. json file first ○ If version specified there, it will download latest version that matches what you define ○ Will update composer. lock with the downloaded version ○ If no composer. lock, it will be create.
Create - Project
Create - Project ○ This is the equivalent of git clone then composer install
Create - Project composer create-project laravel/laravel your-project-name 4. 2. *
Lets Recap ○ We know how to use composer to manage dependencies ○ We know how to create/list these dependencies ○ We know how to install them ○ We know where they are located ○ We know how to add our custom code ○ We know how to define our dependency versions ○ We know what commands to run and when
Composer and Drupal 8
Let’s install Drupal!!
Drupal Composer Project https: //github. com/drupal-composer/drupal-project
Composer installers
drupal-composer/drupal-project "extra": { "installer-paths": { "web/core": ["type: drupal-core"], "web/modules/contrib/{$name}": ["type: drupal-module"], "web/profiles/contrib/{$name}": ["type: drupal-profile"], "web/themes/contrib/{$name}": ["type: drupal-theme"], "drush/contrib/{$name}": ["type: drupal-drush"] }, "patches": {}, "branch-alias": {} }
Composer installers ○ Plugin for Composer ○ Allows a package type to be mapped to an install path ○ https: //github. com/composer/installers
Custom installers ○ Plugin for composer to define your own types and paths ○ https: //github. com/davidbarratt/custom-installer ○ Can create type: kmoll-module ○ Then can map that to an install path
Drupal Scaffold
Drupal Scaffold ○ Plugin that will download scaffold files when using drupal/core ○ https: //github. com/drupal-composer/drupal-scaffold ○ Will build out the rest of the Drupal and Webroot structure
drupal-composer/drupal-project "scripts": { "drupal-scaffold": "Drupal. Composer\Drupal. Scaffold\Plugin: : scaffold", "post-install-cmd": [ "Drupal. Project\composer\Script. Handler: : build. Scaffold", "Drupal. Project\composer\Script. Handler: : create. Required. Files" ], "post-update-cmd": [ "Drupal. Project\composer\Script. Handler: : build. Scaffold", "Drupal. Project\composer\Script. Handler: : create. Required. Files" ] },
A Quick Example
The Big Picture
Creating a site from scratch
Initialise ○ Create the “placeholder" repository with some hooks and composer. json ○ Install composer ○ hirak/Prestissimo FTW ○ Run composer ○ Do some cleanup ○ Push to Github
Do not ask any Minimum-stability interactive We want any 1. 0 allowed version below 2. 0 question composer create-project --no-interaction --stability dev org/repo: ~1 Let’s create a new project! /path/to/project --repository-url="https: //user: pass@toranprivateurl. com/repo/private/"
Go Acquia ○ We clone our Acquia repository ○ Generate the settings. php file ○ Generate some extra files
Sync!
drush site-install
That’s nice, I want my D 8 config
Propagate!
Recap
Deploying Changes
Behind the scenes ○ We cloned both Github and Acquia ○ Installed Prestissimo ○ Ran Composer Install ○ Sync’d ○ Imported D 8 Config ○ Drush cache-rebuild
Q&A
JOIN US FOR CONTRIBUTION SPRINTS First Time Sprinter Workshop - 9: 00 -12: 00 - Room Wicklow 2 A Mentored Core Sprint - 9: 00 -18: 00 - Wicklow Hall 2 B General Sprints - 9: 00 - 18: 00 - Wicklow Hall 2 A
WHAT DID YOU THINK? Evaluate This Session events. drupal. org/dublin 2016/schedule THANK YOU!
- Post-drupal-scaffold-cmd
- Goanywhere advanced workflows
- Disease-specific workflows
- Modern project profiles in software project management
- Jira workflow diagram
- Sirsi workflows
- The unified software development process
- Emulsify drupal
- Drupal datalayer
- Drupal hook menu
- Component libraries drupal
- Sukin wiki
- "drupal lingotek"
- Desarrollo web drupal
- [drupal lingotek]
- Ab testing presentation
- Chaos tool suite
- Aws drupal hosting
- Www.joomlainlibrary.com
- Woo hoo
- Drupal oregon state
- Envayasms
- Drupal crm integration
- Dynamic duel
- Drupal migrate d2d
- Drupal 508 compliance
- Joomla vs plone
- Carmina burana composer
- Us composer glass
- Fx composer
- Joseph mendoza composer
- Netscape composer download
- Buxtehude composer
- Composer des phrases
- 奇异恩典
- Was vivaldi a priest
- Evan williams composer
- Danny elfman film composer
- Medieval composer
- Bach baroque composer
- Visual studio composer
- When i am laid in earth composer
- Rational requirements management
- Wolfgang amadeus mozart was born in 1756 in austria
- Rpo workflow composer
- Composer peter and the wolf
- Sayang sayang si patokaan
- Motion composer
- Motets and rondelles
- Italian composer or pasta
- Russian composer of peter and the wolf
- Paul jennings music k8
- Xml composer
- Was mozart a child prodigy
- Microsoft business rules engine azure
- Epf composer
- Dostoyovsky
- Vasco mendonca composer
- Topbraid composer tutorial
- Ready to go by teresa jennings
- Arcangelo corelli biography
- Mark williams composer
- Classical composer
- Rbk fuktmätning
- Kraft per area
- Multiplikation uppställning
- Elektronik för barn
- Underlag för särskild löneskatt på pensionskostnader
- Borra hål för knoppar
- Smärtskolan kunskap för livet
- Bris för vuxna
- Trög för kemist
- Vad är ett minoritetsspråk
- Ellika andolf
- Datorkunskap för nybörjare
- För och nackdelar med firo
- Blomman för dagen drog
- Returpilarna