drupaleurope org
play

www.drupaleurope.org axelerant.com 1 Lesser known perks of using - PowerPoint PPT Presentation

www.drupaleurope.org axelerant.com 1 Lesser known perks of using composer Drupal Europe 2018 axelerant.com 2 Drupal + Technology TRACK SUPPORTED BY axelerant.com 3 Special Thanks to.. axelerant.com 4 Mohit Aghera Drupal developer


  1. www.drupaleurope.org axelerant.com 1

  2. Lesser known perks of using composer Drupal Europe 2018 axelerant.com 2

  3. Drupal + Technology TRACK SUPPORTED BY axelerant.com 3

  4. Special Thanks to.. axelerant.com 4

  5. Mohit Aghera Drupal developer @Axelerant Drupal.org: mohit_aghera Twitter: @mohit_rocks axelerant.com 5

  6. Quick Introduction Why do we need it? ● How do we use it? ● axelerant.com 6

  7. Drupal Composer initiative Follow updates here: https://www.drupal.org/project/ideas/issues/2958021 axelerant.com 7

  8. Composer scripts Define script in composer.json and run ● Helps to automate tasks ● Supports various events. ● axelerant.com 8

  9. Composer Scripts axelerant.com 9

  10. Composer Plugins Helps to overcome limitation of composer scripts ● Run independently - irrespective of root package ● Helps in creating distributable package ● axelerant.com 10

  11. { Composer "name": "my/plugin-package", "type": "composer-plugin", Plugins "require": { "composer-plugin-api": "^1.1" ● “type” : “composer-plugin” }, ● “extra” : Contains class name "extra": { ● Add special package called "class": "My\\Plugin" “composer-plugin-api” } } axelerant.com 11

  12. Composer Plugins drupal- composer/drupal -scaffold axelerant.com 12

  13. Composer Plugins axelerant.com 13

  14. Patching Requirement to update core of system ● Bugs that are not merged ● axelerant.com 14

  15. Patching axelerant.com 15

  16. Keeping data up to date Pull and process remote data automatically ● Implement Composer Plugins ● axelerant.com 16

  17. Keeping data up to date Benefits: No need to have separate sync code ● Helps to solve problems in continuous integration as data will already be there ● Limitations: It is meant for retrieving and storing data - no live sync. ● axelerant.com 17

  18. Commit Hooks axelerant.com 18

  19. Commit Hooks GIT hooks helps to enforce code quality ● Ensure commit messages are proper ● Coding standards validation ● Sharing GIT hooks with composer has more advantages ● axelerant.com 19

  20. Commit Hooks There are several libraries that supports this type of implementations: https://github.com/sebastianfeldmann/captainhook ● https://github.com/bruli/php-git-hooks ● https://github.com/php-composter/php-composter ● https://github.com/BrainMaestro/composer-git-hooks ● axelerant.com 20

  21. axelerant.com 21

  22. Automatting project structure Composer helps to generate essential files and other code ● Use case : drupal-composer/drupal-project ● axelerant.com 22

  23. Automatting project structure axelerant.com 23

  24. Example from “ScriptHandler.php” axelerant.com 24

  25. Thank you.. axelerant.com 25

  26. Become a Drupal contributor, Friday from 9 AM ● First timers workshop ● Mentored contribution ● General contribution 26 axelerant.com 26

Recommend


More recommend