121: Meet Ryan Weaver - Synergies in Drupal, Symfony2, and PHP - 1/2

A mustachioed Ryan Weaver

Part 1 of a 2-part conversation with Ryan Weaver from SymfonyCon Warsaw 2013 in which we touch on the great Symfony documentation and its team, discovering the power of community in open source (instead of doing it all yourself), Symfony2 components in Drupal 8 bringing the two communities together, the advantages (present and future) of loose coupling in Drupal 8's architecture, the next big thing, and more!

Ryan Weaver is the single biggest contributor to the Symfony2 framework's documentation (which is excellent, check it out!), a self-described Symfony evangelist, and lead at KnpUniversity.com, makers of fantastic PHP tutorial screencasts like this one on using Composer to include PHP libraries in Drupal 7.

Not being the best is the best

Ryan describes getting into an open source software in a way that describes the power of the community. Talking about the first time he saw a friend do scaffolding in Ruby on Rails, "I watched him do this command and thought 'That was 12 hours of work for me that you just did as one command'. The power of that blew my mind and I had to find something that did that in PHP, which is how I ended coming to Symfony. We've all done it: You start, thinking you're the smartest person in the world and doing your own thing ... I was slapped with the reality check of how wonderful it is for people to collaborate because I never could have done that. I would still be working on trying to get something of that functionality."

Drupal + Symfony - How are we doing?

"The code I've seen from Drupal people that have started to do things in more of the namespace/Symfony kind of way, has been incredible. There's a Behat extension for Drupal (Behat: BDD for PHP). It was made more or less by Open Sourcery in Portland and it is incredible! So you have all this Drupal: functions and hooks and all of as sudden, you look at their code, there's dependency injection and all these really advanced things. I've been really pleasantly surprised by the advanced things that they're already bringing to the code itself."

Drupal 8 + Symfony + All the PHP

In answer to the question "What are you most excited about for Drupal 8?", Ryan explains, "I see an increasing number of people that are coming from the Drupal world that are looking at Symfony. Not they're switching to Symfony, but they're increasing their options." He explains how Drupal-the-CMS can be perfectly complimented by a compatible, highly specific, custom Symfony application. "What's really exciting for a Drupal developer or a Symfony developer is when you're in Drupal and run into Symfony pieces, those are going to be the exact same Symfony pieces that you'll see when you're using the Symfony framework or Silex, which is the micro-framework built with Symfony. So whether you're using Drupal or the Symfony framework, or Silex, it is all exactly the same classes, objects, and ideas. So in Drupal, if you're getting the request object and you're getting post information, or files, or something, that is the Symfony request object, that is the Silex request object! The toolsets are being blurred. How dangerous are we now that Drupal people can do custom things and traditional custom developers can do Drupal more easily. It's really really exciting."

"You could integrate a Symfony or Silex project with Drupal. You could have a Symfony project and it goes through Symfony's routing and you get inside of a controller where you normally render the page. You could forward that over to Drupal, pass the request to Drupal because it is a content page. You boot up the Drupal engine and pass the request over there, because they're using the same technologies. Normally, if you have two PHP projects, you can't really put them together. They'll crash into each other. But inside a single thread, we should be able to pass the information over to Drupal. Drupal does its normal page processing (not knowing it's not really the one processing the request) and then it gives back a finished page. Then we use that finished page inside of Symfony and render something."

"Of course, the same thing can be said in the other direction; having Drupal handle something and forwarding it off to Symfony."

As a Drupalist, I will suddenly have huge swathes of the PHP world directly available to me in my toolbox. "Now with Composer, you can find any PHP library on GitHub and it's going to plug in immediately, because Drupal has taken this step to integrate."

APIs are the Future

On the subject of Drupal 8's representation layer being agnostic and able to produce output in HTML5 or JSON or whatever you need, "We all know we're moving more to APIs. It doesn't mean that the traditional web app is going to go away entirely, but more and more things are being done as an API. Then you have a Javascript front-end, or a device or whatever else. With open source projects, especially as big as Drupal, you can't make that change overnight, so I think it's very forward thinking to put that in now. There's some learning curve and it's a very aggressive step, but fast-forward five years from now and everyone's going to say, 'Thank God we did that!' because if we wait five years, it's gonna be too late."

Decoupled Developer Days

Decoupled Developer Days

Saturday, August 19, 2017 - 08:00 - Sunday, August 20, 2017 - 04:00
NBCUniversal NYC Headquarters 30 Rockefeller Center New York, NY 10020

Add comment

By submitting this form, you accept the Mollom privacy policy.