Use Drupal 8 as a framework
The romance recalibration
Kevin Wenger
Web Developer @ Antistatique
ƛ
wengerk wengerk
sudei
- Drupal Expert
- Open source Enthusiast
- Coder lover
wengerk
Summary
- Drupal 7 vs Drupal 8
- Overview of API’s
- Injection
- Services
- Entity
- Block API
- Cache
- Template
- 3 case studies
- Best Practices @ Antistatique
VS
25
50
75
100
2016-08-14 2016-10-16 2016-12-18 2017-02-19 2017-04-23 2017-06-25
Drupal 7
Drupal 8
8.1.x
beta rc 8.2.x
beta rc 8.3.x
Differences
procedural
Hooks everywhere
callback functions
magically named functions
Object-oriented
Dependencies management
logic is grouped together
definition with annotation
APIs First
UI Second
Injection
- Standardize
- Centralize
- Extensibility
- Testable
SwiftMailer MailJet
Newsletter
Injection
- Standardize
- Centralize
- Extensibility
- Testable
SwiftMailer MailJet
Newsletter
Injection
- Standardize
- Centralize
- Extensibility
- Testable
Newsletter
SwiftMailer MailJet
Injection
- Standardize
- Centralize
- Extensibility
- Testable
Types of injection
- Constructor
- Setter
Newsletter
SwiftMailer MailJet
Injection
- Standardize
- Centralize
- Extensibility
- Testable
Types of injection
- Constructor
- Setter
Newsletter
SwiftMailer MailJet
Injection
- Standardize
- Centralize
- Extensibility
- Testable
Types of injection
- Constructor
- Setter
Newsletter
SwiftMailer MailJet
Services
Everything that your app "does" is actually
done by a service
- Decoupled
- Reusable
- Pluggable
- Testable
Services
Everything that your app "does" is actually
done by a service
- Decoupled
- Reusable
- Pluggable
- Testable
Services
Everything that your app "does" is actually
done by a service
- Decoupled
- Reusable
- Pluggable
- Testable
Services
Everything that your app "does" is actually
done by a service
- Decoupled
- Reusable
- Pluggable
- Testable
Entity
Built-in
- User
- Node
- TaxonomyTerm
- File
- Comment
Entity
Built-in
- User
- Node
- TaxonomyTerm
- File
- Comment
Entity
Built-in
- User
- Node
- TaxonomyTerm
- File
- Comment
Entity
Built-in
- User
- Node
- TaxonomyTerm
- File
- Comment
Entity
Built-in
- User
- Node
- TaxonomyTerm
- File
- Comment
Blocks API
Usage
- @Block Annotation
- Extend BlockBase
- Implement methods from
BlockPluginInterface
Your website is a Lego playground
Build it w/ Block
APIs
- Block Plugin API
- Block Entity API
Blocks API
Usage
- @Block Annotation
- Extend BlockBase
- Implement methods from
BlockPluginInterface
Your website is a Lego playground
Build it w/ Block
APIs
- Block Plugin API
- Block Entity API
Blocks API
Usage
- @Block Annotation
- Extend BlockBase
- Implement methods from
BlockPluginInterface
Your website is a Lego playground
Build it w/ Block
APIs
- Block Plugin API
- Block Entity API
Blocks API
Usage
- @Block Annotation
- Extend BlockBase
- Implement methods from
BlockPluginInterface
Your website is a Lego playground
Build it w/ Block
APIs
- Block Plugin API
- Block Entity API
Headers
- Passed along with every request
- Easy reverse proxies
Cache
Keep your cache activated
Contexts
- Request driven
- Invalidated by time
Tags
- Data driven
- Invalidated by data
Headers
- Passed along with every request
- Easy reverse proxies
Cache
Keep your cache activated
Contexts
- Request driven
- Invalidated by time
Tags
- Data driven
- Invalidated by data
Headers
- Passed along with every request
- Easy reverse proxies
Cache
Keep your cache activated
Contexts
- Request driven
- Invalidated by time
Tags
- Data driven
- Invalidated by data
Headers
- Passed along with every request
- Easy reverse proxies
Cache
Keep your cache activated
Contexts
- Request driven
- Invalidated by time
Tags
- Data driven
- Invalidated by data
Template
Display mode
- Teaser
- Full
- Card
Twig
- Macro
- Include
- Extend
Template
Display mode
- Teaser
- Full
- Card
Twig
- Macro
- Include
- Extend
Case studies
I hate programming
I hate programming
I hate programming
It works!
I ❤ programming❤
Jan
2017
Portail GED
- User Management
- File API
- Migrate API
- LDAP
- SSO
- ACL Data Driven
- Solr Search Engine
- Behat
Jan
Apr
2017
- Previously Drupal 7
- Migrate API
- Core Authentication
- Dynamic Page Cache
- REST Compliant
Epic Game Jam
Quartiers Solidaires
Jul
Jan
2017
Apr
- Content Management
- Core Authentication
- i18n
- Form API
- Dynamic Page Cache
- Behat
Best Practices
@ Antistatique
100%
aranteedSATISFACTION
Automatic Quality Control
- PHPCS - Code Sniffer for Drupal & DrupalPractice
- PHPMD - Mess Detector
- PHPCPD - Copy/Paste Detector
- Script as post-commit git hook
100%
aranteedSATISFACTION
Automatic Quality Control
- PHPCS - Code Sniffer for Drupal & DrupalPractice
- PHPMD - Mess Detector
- PHPCPD - Copy/Paste Detector
- Script as post-commit git hook
100%
aranteedSATISFACTION
Automatic Quality Control
- PHPCS - Code Sniffer for Drupal & DrupalPractice
- PHPMD - Mess Detector
- PHPCPD - Copy/Paste Detector
- Script as post-commit git hook
Tests
- It’s cheap to code, it’s long to run
- Unit - PHPUnit
- Kernel - Bootstrapped kernel
- Functional - Booted Drupal
- BrowserTest
- Behat + Default Content + Script
Thanks ./
wengerkwengerk
Questions ?
- Stop using Drupal 7 start Drupal 8 now
- Skinny Models, Skinny Controllers, and Service Objects
- Use D8 APIs instead of Hooks & Global functions
- Code with Cache to avoid surprise
- Please, add some Quality Control
Slideshare: bit.ly/meetup-d8-framework
ExclusivE
ORIGINAL
QuestionsAnswers

Use drupal 8 as a framework the romance recalibration