Slide 1

Slide 1 text

Drupal: Re-joining the Herd PHP South Coast 2016 Oliver Davies / @opdavies

Slide 2

Slide 2 text

Drupal: Getting o the Island PHP South Coast 2016 Oliver Davies / @opdavies

Slide 3

Slide 3 text

Drupal: Re-joining the Herd PHP South Coast 2016 Oliver Davies / @opdavies

Slide 4

Slide 4 text

@opdavies Senior Drupal Developer at Former Drupal Association employee Symfony hobbyist Drupal Bristol organiser, PHPSW and DrupalCamp Bristol co-organiser First PHP conference! Appnovation Technologies

Slide 5

Slide 5 text

Purpose If you're new to Drupal, go and try it If you've used it before, re-try it

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

About Drupal Drupal is an open source, PHP content management system 16 years old Drupal 8 was released in November 2015 Non-BC changes between major versions Mostly procedural code prior to D8 Drupalisms

Slide 8

Slide 8 text

Entities(ish) Everything uses s t d C l a s s No consistency between models

Slide 9

Slide 9 text

Hooks / / h e l l o . m o d u l e / * * * I m p l e m e n t s h o o k _ m e n u ( ) * / f u n c t i o n h e l l o _ m e n u ( ) { $ i t e m s [ ' h e l l o - w o r l d ' ] = a r r a y ( . . . ) ; r e t u r n $ i t e m s ; }

Slide 10

Slide 10 text

Theme functions $ i t e m s [ l ( ' F o o ' , ' f o o ' ) , l ( ' B a r ' , ' b a r ' ) , ] ; r e t u r n t h e m e ( ' i t e m _ l i s t ' , [ ' i t e m s ' = > $ i t e m s ] ) ; < u l c l a s s = " i t e m - l i s t " > < l i > < a h r e f = " f o o " > F o o < / a > < / l i > < l i > < a h r e f = " b a r " > B a r < / a > < / l i > < / u l >

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

http://www.ekino.com/wp-content/uploads/2013/09/drupal8-meets-symfony.jpg

Slide 13

Slide 13 text

http://jmolivas.com/slides/drupalcon2015bogota/speeding-up-drupal-8-development-using-drupal- console/assets/images/larry-crell.jpg

Slide 14

Slide 14 text

Symfony Core developed using Symfony components Minimum PHP version requirement PHP code in classes No more functions (almost) Namespaces PSR-0 PSR-4 Autoloading Dependency injection Full test coverage Consistency!

Slide 15

Slide 15 text

Symfony components ClassLoader Console CssSelector DependencyInjection EventDispatcher HttpFoundation HttpKernel Process Routing Serializer Translation Validator Yaml http://symfony.com/projects/drupal

Slide 16

Slide 16 text

YAML example.info (D7) n a m e = E x a m p l e c o r e = 7 . x p a c k a g e = C u s t o m d e p e n d e n c i e s [ ] = e n t i t y f i l e s [ ] = a . i n c f i l e s [ ] = b . i n c example.info.yml (D8) n a m e : E x a m p l e t y p e : m o d u l e c o r e : 8 . x p a c k a g e : C u s t o m d e p e n d e n c i e s : - e n t i t y

Slide 17

Slide 17 text

Routing (D7) hello.module f u n c t i o n h e l l o _ m e n u ( ) { $ i t e m s [ ' h e l l o - w o r l d ' ] = [ ' t i t l e ' = > ' H e l l o , P H P S C ' , ' p a g e c a l l b a c k ' = > ' h e l l o _ p a g e _ c a l l b a c k ' , ' a c c e s s a r g u m e n t s ' = > [ ' a c c e s s c o n t e n t ' ] , ] ; r e t u r n $ i t e m s ; }

Slide 18

Slide 18 text

Routing (D8) hello.routing.yml h e l l o . v i e w : p a t h : / h e l l o - w o r l d d e f a u l t s : _ t i t l e : ' H e l l o , P H P S C ' _ c o n t r o l l e r : ' \ D r u p a l \ h e l l o \ C o n t r o l l e r \ P a g e C o n t r o l l e r : : h e l l o V i e w '

Slide 19

Slide 19 text

Annotations Used in some places - e.g. plugin system

Slide 20

Slide 20 text

Twig Default theme engine in D8 Replaces phptemplate No more database queries in templates No more theme functions

Slide 21

Slide 21 text

Not Invented Here

Slide 22

Slide 22 text

Not Invented Here

Slide 23

Slide 23 text

Proudly found elsewhere jQuery * Symfony Symfony CMF CKEditor Zend Composer Stack Guzzle Twig PhpUnit http://cgit.drupalcode.org/drupal/tree/core/composer.json

Slide 24

Slide 24 text

Composer Drupal 8 using Composer for dependency management and autoloading Better Composer support since 8.1 Composer integration on Drupal.org Drupal Composer projectroject template Project template Drupal Packagist

Slide 25

Slide 25 text

Drupal via Composer " r e p o s i t o r i e s " : [ { " t y p e " : " c o m p o s e r " , " u r l " : " h t t p s : / / p a c k a g e s . d r u p a l . o r g / 8 " } ] , r e q u i r e : { " d r u p a l / c o r e " : " ~ 8 . 0 " } , . . . https://github.com/platformsh/platformsh-example-drupal/blob/8.x/composer.json

Slide 26

Slide 26 text

Contrib - Symfony WebPro ler Bundle as a Drupal 8 module - adds a GUI for Composer dependencies - PSR-4 support for Drupal 7 Web Pro ler Composer Manager xautoload

Slide 27

Slide 27 text

Libraries rst Non-Drupal problems being xed outside of Drupal Framework agnostic PHP libraries Better exposure Production tested code Allows for backports

Slide 28

Slide 28 text

Libraries rst

Slide 29

Slide 29 text

Libraries First

Slide 30

Slide 30 text

Drupal Console A CLI tool for generating Drupal code and interacting with Drupal 8 websites Based on Symfony Console component PSR-2 coding style, outputs Drupal code style http://drupalconsole.com

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Going forward Semantic versioning Feature releases every 6 months https://www.drupal.org/core/release-cycle-overview

Slide 33

Slide 33 text

More to do? Still some Drupalisms PSR-2 GitHub/Packagist Drupal CI

Slide 34

Slide 34 text

In Summary Lowered the barrier to entry for PHP Developers Made me a better Developer More transferable knowledge and skills Changed perspective

Slide 35

Slide 35 text

Links drupal.org drupal.org/8 drupal-composer.org

Slide 36

Slide 36 text

Questions?

Slide 37

Slide 37 text

DrupalCamp Bristol 22nd - 24th July phpsc-fri - £20 off the business day phpsc-sat - £5 off the conference day https://www.drupalcampbristol.co.uk

Slide 38

Slide 38 text

Feedback Joind.in: https://joind.in/talk/41d0f Twitter: @opdavies