Symfony, Twig, Backbone, Guzzle. What are these things?
A lot of new libraries and technologies have been added to Drupal 8. This session will go through the new libraries and provide a brief introduction to them by looking at some history, and the effects of including them in Drupal.
This will be a high-level introduction - not a deep technical walkthrough. It is suitable for everyone, regardless of skill level, who is interested in the building blocks of Drupal 8.
3. WHAT IS GOING ON IN THIS TALK?
What is an external library?
Some history through Drupal releases.
For most of the new libraries - a short description.
4. AN EXTERNAL LIBRARY
Code that lives somewhere else than on d.o. and is maintained
by people that are not nescessarily drupal people.
Can be used by other projects and benefit from collaboration
from a lot of people.
In D8 - anything that lives in /vendor or /assets/vendor.
5. DRUPAL 4.7
RELEASED IN MAY 2006
There were no external libraries apart from a forked version of
The Incutio XML-RPC Library
We knew how to do things best ourselves
6. AS FOR JAVASCRIPT: THERE WAS VERY LITTLE
»fn .-ae".s
id
nm *j"
.ms/uoopeej
/icatcmlt.s
.ms/olpej
/icclas.s
.ms/rplj
/icdua.s
.ms/rgesj
/icpors.s
.ms/etraj
/ictxae.s
.ms/paej
/icudt.s
.ms/podj
/icula.s
7. DRUPAL 5
RELEASED IN JANUARY 2007
2 external libraries were added to Drupal.
One was really important - the other one not so much.
8. JQUERY!
Write less, do more.
Javascript tools with a really active community.
Everybody agreed that it was a great idea to get it in core, so
from the proposal to when it was committed was less than 2
months.
Issue: Pave the way for integration of jQuery into core
9. MORE JAVASCRIPT
The external library "Farbtastic" was added.
The total of Javascript files that shipped with Drupal was 11. 2
of them external
11. MORE (DRUPAL) JAVASCRIPT IS SHOWING UP
There is a total of 23 JS files.
Still only 2 of them are external libraries.
12. DRUPAL 7
RELEASED IN JANUARY 2011
Now things start happening.
The PHP library Archive tar by Vincent Blavet was added
There is a total of 85 JS files. A whopping 37 of them are
external libraries. They are almost all jQuery libraries.
Most prominent is probably jQuery UI. It is a collection of UI
components like a datepicker, accordions and so on.
13. BUT WHAT ABOUT SIMPLETEST?
Well, we only used the concept - not the library.
The impact was immensely positive, but it was still stuff we rolled
ourselves.
14. DRUPAL 8
RELEASED SOME TIME IN THIS DECADE
Now the fun starts!
We have 193 Javascript files. Of them 87 are external.
17. SYMFONY2
Symfony2 is a lot of loosely coupled components.
It offers us a lot we didn't need to invent ourselves.
The first piece of Symfony2 was put in core in October 2011.
Issue: Add Symfony2 HttpFoundation library to core
19. COMPOSER
Dependency manager
Inspired by package managers for other programming
languages like Ruby and Node.
Only used in core for managing external dependencies.
A library declares its dependencies in a composer.js file.
20. PHPUNIT
Whew.
A mature testing framework that works well for testing OOP
classes.
Testing is much lighter loadwise with PHPUnit.
Has a mocking framework.
Cannot replace our version of simpletest but still is a game
changer.
Issue: Start using PHPUnit for unit tests
21. ASSETIC
A Symfony component.
A way for Drupal to find stuff like your CSS or JS.
A way to include libraries.
There are 'filters' so that you can use LESS, SCSS, Coffeescript,
etc. and have Assetic compile/massage your files.
Plays nice with Twig.
Issue: Add Assetic component to core
22. GUZZLE
A much needed upgrade of the way Drupal does HTTP
requests.
Useful for creating/using web services and a lot of other things.
Guzzle "just" wraps cURL.
Maintainers were very helpful in accommodating Drupal's use
of the library.
Issue: Adopt Guzzle library to replace drupal_http_request()
23. DOCTRINE COMMON
A bit like Symfony - a bunch of libraries like DB abstraction
layers etc.
We have incorporated the "common" library.
We use it for parsing annotations plugin definitions.
Issue: Add the Doctrine Common PHP library
24. CKEDITOR
This one I think many people know already.
Not having a WYSIWYG has been a serious lack in Drupal - as
well as a feature ;-)
It took a while to make a decision. Initially Aloha editor looked
like it was going in.
Issue: Add CKEditor JS library to core
28. BACKBONE.JS AND UNDERSCORE.JS
Backbone depends on Underscore.
Underscore is a set of low-level utilities for manipulating
arrays and objects.
Backbone is an MVC - Model - View - Controller solution for
javascript.
Gives a lot of freedom in building web apps.
In core so far - it is used on contextual links and in the toolbar.
Issue: Add Backbone.js and Underscore.js to core
29. MODERNIZR
A library that helps detecting older browsers that lack
capabilities.
Most websites use it, or something like it, today already.
Also makes it possible for other libraries to check for browser
support.
Issue: Add Modernizr to core