 Okay, I think we are going to start now Are you ready? Yeah? Okay Okay, so the session is about Drupal and Symphony or Symphony and Drupal So my name is Fabien Potentier So I'm the lead developer and the founder of Symphony Symphony being a web framework I'm also the lead developer of several other open-source libraries I have Some of them listed on the screen. I'm also the founder of Sensio Labs Sensio Labs is a company I found it 14 years ago and it provides services on Symphony of course. Hi, I'm Lucas Fabien asked me to join this talk. I Am I live in Switzerland work for a company called Leap Being involved in PHP core development and now I've basically moved on to Symphony 2 development I'm also the co-lead on the PHP CR contrary repository specification. There was a poor conversation on that tomorrow and I just wanted to Start things off a little bit with a question and Who here considers themselves to be a PHP developer first? Okay Then the second question I wanted to ask who here is aware of what symphony is and what it does Okay, that's actually a surprise. I wasn't expecting so either either Google was really busy since the keynote yesterday Or more people than we thought in the Drupal community were already using symphony so Both of us are sort of outsiders in the sense that we're not Drupal developers At least I don't know what about about Sensio, but at least I think we use Drupal I've been partially involved in some of these projects, but not directly just helping with some mysql optimization here and there So we are aware of pretty much how Drupal works But we've never really looked into the guts of things and not worked on the core at all So that just as a disclaimer upfront What is that about that or let's say we're both fairly experienced PHP developers But at the same time we would probably totally lost if we ever looked into the core of Drupal And I've been actually quite involved with the whiskey team Larry and so on talking and they kept like Explaining me like for paragraphs what they were asking me and I didn't I had a really hard time getting it and it took a lot of time and The fact of the matter is that Drupal has its very specific Drupal way And that is a term that I also learned while I was talking starting to work with Larry And if we do spend the time to learn about Drupal Whatever we learn along the way will only help us with Drupal This will not help us if we go on to a different project change languages change application and that things like that happen You know, so it really would be learning for Drupal not growing or programming experience So other people That are not following the Drupal way have adopted object oriented Programming paradigms design patterns and things like that much more openly I mean I saw I do know a little bit about what has happened in Drupal in the history So I do know that Drupal 7 the amount of object orientated code has Risen by a hundred percent because it was zero before or something like that Okay So and they're leveraging all these new language features and if you look at what PHP the language itself how it's evolving a lot of Attention is put on all these object oriented features a lot of the performance improvements are happening there And so it's sort of unfortunate that the Drupal way or at least the Drupal way How it has been over the past years has not really leveraged all of that what is happening in the other parts of the PHP community so Obviously, we're not here to come here and say you've done it all wrong for the past decade because obviously Drupal is a significant conference of Significant community and actually I was talking to Fabian before I think this is the biggest symphony to talk ever I Mean and we had dedicated conferences to symphony to and all of that so so the point we're trying to make is really and is that Maybe it's time to look at what parts of the Drupal way Should be kept and maybe what where else maybe there could be more advantages in adopting what other people in the community are doing And here I'm quoting a blog post by Dries from a couple weeks ago where he's basically hitting on exactly that point Drupal has evolved to a fairly complex system and It's so complex by now that only people that really have Participated in the evolution can really grasp the core of Drupal itself And as a result if any of these people that were there from the beginning leave There's a huge void that is left. That is very hard for anybody else to fill now What could be gained by using symphony the big thing that could be gained is that? Drupal is currently and that again was the point that Dries was making in the keynote is sort of an evolutionary process or Redefining itself to a certain extent and one of these core ideas of Drupal 8 was to become or to more clearly Identify a framework core and obviously taking from another framework that has already find itself very defined core Could help and facilitate that More importantly Drupal is a content management system and so That's where your resources should be allocated to it shouldn't be allocated to doing You know the low-level stuff that other people have done before it should be focused on the content management system aspects now Another opportunity here is that other applications that are using these principles Will be much easier integrated to Drupal and vice versa if you know these standard paragliders are adopted and so as a result Dries sort of announced. I don't know exactly how these processes are I've I've lurked a little bit into all these different threads and discussions for him So understand a little bit about how the process in Drupal works But I assume that the blog post by Dries has a certain significance and There it sounded like he was saying it's time to embrace this More standardized approach for the low-level pieces in order to grow Drupal further and to better leverage resources and to get more resources into Drupal itself now Symphony 2 is really keen on this collaboration and we've been keen on the collaboration with many Communities as a matter of fact and that's one of the reasons why we chose a very liberal license Actually, Symphony 1 already had the same license MIT is GPL compatible. So from a legal point of view, there shouldn't be any problems adopting Symphony 2 I think in theory you could even realize Realize the Symphony 2 as GPL So on the legal aspects collaboration should work just fine The Symphony 2 development itself is entirely Open on GitHub. We're the most forked most watched PHP project. We have daily 10 pull requests coming in Being reviewed by the entire community And we're really like I said committed to becoming the basis for many other Applications not just Drupal, but also PHP VB and other frameworks content management systems and so on so forth So as an example the Symphony 2 We have a system called flash messages, which is sort of the the solution to pass the message just to the very next request Now while the Drupal team was reviewing how they could leverage the Symphony 2 components They noticed that this is very similar to a Drupal set message However, there were still a couple issues there and some limitations So we started looking at how to fix that and it's just enough another content management system that is also starting to adopt some of the Symphony 2 components The lead developer of that project also saw these limitations created a pull request and we actually Ask for feedback also from the Drupal team to evaluate these changes and bring those into Symphony to become More useful for the general community of PHP So now I'll hand this over to Fabien who has all the details on some code examples There exactly so enough talk enough about marketing now. Let's see some code So the first question I want to answer today is what is symphony and First you must know that when I say symphony, I'm talking about symphony version 2 Right symphony version 1 being a totally different product. So if you know something about symphony 1 That does not apply to symphony 2 Of course, it does not apply to the integration of symphony into Drupal, right? So we are talking about symphony version 2 symphony is a set of PHP components and each component solves a common development problem Right from abstracting HTTP messages to creating common line tools or Converting XPath expressions to their CSS selectors equivalent for instance So symphony tries to solve each problem independently of other ones So that you can use one component without installing any of the other ones The symphony components are implemented in such a way that we try to leverage the best practices and We try to borrow the best ideas from other frameworks and actually also other languages And of course being components we try to make them flexible and extensible in technical terms symphony is an object oriented set of classes That uses the PHP 5.3 version the new features like name spaces and Those set of classes provide tools to every PHP developer So as of today, we have 21 PHP components some of them are more important than others Because they are the building blocks of any websites, right? So I'm going to talk about some of them today Then Based on these components symphony is also a full stack web framework And the full stack web framework is probably the most known a set of the symphony project and Probably the most popular nowadays But today I won't talk about the full stack web framework because Drupal is only adopting Small subset of the components, right? So we have the components and Drupal is Using some of them is going to use some of them and not the full stack framework If you want to learn more about symphony, you can go to the official website symphony.com and The official repositories on github and the organization is symphony Right and if you go to symphony dash project org This is the legacy website for the version one of the framework So if you want to learn more about the symphony components, you can go to this page Slash components We have a bunch of information about how to install the components about the code where you can get the code and the Documentation and all the repositories are also also in on github Which means that if you get symphony symphony on github you have the full stack framework But if you want to only Get one component then you can use one of those repositories on github, right? you don't need to get all the components and Last but not least if you have any question on symphony, you can join us on the mailing list or On free note for the RSC channel The other thing is on the website anyway So as Lucas said we try very hard to help Communities to adopt symphony as their low-level architecture and we think that's a good thing because then we can share code So Even if I told you that the symphony components are not that well known We already have quite a few open source project already using them For instance some developer tools. I don't know if you know be at this is a BDD framework They are using quite a few components that train and propose They are the two biggest object relational mapper in PHP. They are also using Some symphony components PHP unit, which is probably the de facto standard for unit testing in PHP Even I think Drupal is not using PHP unit Okay, so there's discussion about switching from simple test I think to PHP unit Right now, okay We also have some frameworks which can sounds weird But selects is a macro framework based on most of the symphony two components But also PPI to version two is also a framework that is going to use more symphony components for their new Version this is quite interesting and of course and user products Is it booked which is a book publishing platform mid-watt CMS, which is a content management framework And PHP BB, which is probably the most popular forum in PHP. They are already using it even spatter Component and they will probably be using most of the symphony two components for their next version So what about Drupal? Drupal is not going to use all the symphony components But as Drew said in his keynote it will probably use quite a few of them Today I won't have time to talk about all of them, but I want to focus on the main ones so As of today We know that Drupal is probably going to use the edge to be foundation edge to be kernel Components there are the two main components we have the class loader of course and also because Drupal 8 is going to use edge to be kernel It will also use the routing system the even spatter and dependence injection I will talk about all of them except the dependency injection one because I need one hour to talk about dependency injection And what a dependency injection container is so I won't have time to talk about that But actually this is quite simple to understand and if you want to know more about that You can go to my website my personal blog. I have a series of articles explaining what dependency injection is Okay, so the first step before being able to use the symphony components is of course to be able to install them And we have a bunch of different options here The first one is of course to use the git repository directly So you can clone the repository or you can get one of the tag we have for all the versions You can download an archive from github directly if you want You can use per or you can use composer composer being the new PHP installer And it is able to manage all the dependencies for your project But the good news is that Drupal as a Drupal developer You don't need to take care of all this because by default the symphony components are actually included directly into Drupal 8 So that's done for you nothing to do The first component that Drupal uses is the class loader one It gives you a way to autoload all your PHP classes so that files So that the files where your classes are defined are only loaded on demand only when needed Class loader is able to autoload any PHP class If it follows some convention so for PHP 5.2 You need to follow the per naming convention and for a project using namespaced classes Then there's also a naming convention that is being adopted by many major PHP projects Drupal included And this naming convention is described in this document psr0 And this document has been created and improved by many different open source projects and Drupal and symphony were part of this process So this is how you can use The class loader Component so first you require the universal class loader class Which is the only require one statement you need to use in your PHP project Then you use the universal class loader you register some namespaces And then you register the autoloader in PHP right praise You can do the same with Classes following the PHP the per naming convention and that's all it's really easy So the symphony class loader component loads your project classes automatically If they follow some solid conventions and the good news is that Drupal is adopting those conventions The next component I want to talk about is HTTP foundation. This is probably one of the most important component we have in symphony and because of HTTP so symphony leverages open standards as Much as possible and one of them of course is HTTP because as web developers We are using HTTP all the day, right? So FCP is defined in the rfc 2016 which is the specification for HP 1.1 and If that's not already the case I I highly recommend you to read the specification, right? This is really important if you are a web developer if you are a PHP developer Please go read the HP specification and if you do so I recommend you to actually read the HPP's document, which is the second URL on the screen and This is exactly the same as the original documentation document But it clarifies the HP specification and the organization is also much better So this is how the web works You have a user the user ask a resource in a browser, right? like this Then the browser sends a request to the server. So this is actually a request as you can see an HTTP request is just plain text The server then does something with the request and sends back a response to the browser And this is a typical response, right again just plain text And of course the browser then displays the resource to the user So we have a client the client can be a browser. It can be about the web service curl, whatever you want It create a request It sends a request to the server the server can be anything Apache NGNX Whatever and then it does something about a request and sends back a response to the browser and the request and the response are actually what we call HTTP messages, right So how do you represent this request this HTTP message in PHP? with global variables, right horrible, so if you want to get Something from the query string you need to use the underscore get global viable, right? If you want to get something from the session, this is the same if you want to get the method name Same you need to use global variables, right? Let's take another example This one I want to get the client IP, right? So there is something removed address in underscore server that gives you the remote address of the client, right? No, actually no this code is wrong Because if you have a proxy or if you have a reverse proxy between the client and the server then this is not The IP address of the client if you want to get the IP address of the client This is what you need to do, right? And there's a convention When there's a proxy it adds its IP address to a new HTTP header Which is x forwarded for right and as this is an HTTP header You can't trust it, right? So even this code is wrong Right, it is not secure if you want to be secure need to trust the proxy So if you know that there is a reverse proxy that you trust then you can use this x forwarded for error If not, please don't do that, right? It is not secure So there is a lot of work just to get the client IP So using plain PHP Means that first it's not object oriented, of course, so that's a big problem probably Then you know it is like a singleton Right, you we are talking about global variables. It means that it is really difficult to simulate a request What if I want to test my code? What if I want to mark a request that's just not possible in PHP? Of course, you can override the underscore get global variable But overriding the underscore server variable is much more involving right? It's not easy to do It's a lot of abstraction, right? As I said before if you want to be secure then you have a lot of work to do right and Yeah, it's not object oriented really Okay, so in symphony Being an object oriented framework. We have a request object, right? So this is a data object actually. This is just a representation of the HTTP message So as you can see you can create a request from the global variables This is what you want to do most of the time But if you want to create a test then you can simulate a request by training directly So the first argument is is the path of the request then the method and then we have a bunch of arguments you can add to that and We you can also override the global variables from Requests you have created right Okay, we have many more methods on the request object to get things from the query string from the session to get the client IP and then as you can see at the bottom of the screen you can also trace the proxy data only if You have a trusted reverse proxy between the client and the server So this is for the request Now let's have a look at the response This is exactly the same in PHP if you want to manipulate the response you can't really manipulate the response What you can do is you can call Functions right you can call the header functions to set the status code to set some headers You call set cookie to set a cookie you use the underscore session global variable to send some session Values and to actually create the response content you use echo Wow so again This is like a singleton again you can't simulate a response So if you want to test if you want to mark the response, this is impossible, right Again, this is a lot of abstraction only So for instance if you want to manipulate the HTTP cache headers for instance if you want to create a cache control header It's not that easy to get right and there's no abstraction. It's up to you to get it right and It does not play well with the common line interface if you have already Tried to actually simulate the response from the command line in a simple test or in the unit test The headers underscore least function does not work on the command line interface Which means that by default it returns an empty array even if you have called the header function. I don't understand why and Even worse if you want to get the HTTP status code You have set in your code. You need to use the HTTP underscore response underscore code function Which is only available as of PHP 5.4 Yeah, before that it is impossible Right so again in symphony and yeah, of course, it's not object oriented So in symphony we have a response object And you can set the content you can set a status code you can set the others Which means that you can simulate response if you want and whenever you want to send it back to the browser You just need to call the same method right much better. We have some nice abstractions So if you want to stream a response, we have an object for that a streamed response It takes an anonymous function so that you can stream the response back to the client We have many other abstraction like this like this one. This is another example and Last but not least this one is probably the most important one the prepare method Because you know we try to be as HTTP compliant as we can be right so when you call this method based on the request We tweak the response accordingly so that it you know it is HTTP compliant So for instance if the response method is add then we remove the content Right because for a request the content should be empty right Okay, and of course we also have session management with Different storage provider like mem ksd, redis, pdo, defect system of course and everything works out of the box right we have flash messages support and We are already compatible with the new PHP 5.4 session handler interface with a forward Compatibility for PHP 5.3 So that's our job to implement all those stuff so that you don't have to take care of that to sum up the symphony HTTP foundation component defines a featureful object-oriented layer on top of the HTTP specification right and It replaces PHP native global variables and functions to allow writing better More secure and more testable code Next one next one is the routing component I won't talk about this one much as Drupal is going to rely on a different implementation that the default provided by symphony Almost because yeah because of You know Drupal need to keep backward compatibility as much as possible and also because Drupal has so many routes 300 something too many routes But still but still Drupal want to benefit from the interfaces defined in this component and Using the same interfaces means that Drupal will be compatible with all the other projects that also use the routing component So routing is about two different things first You need to create some routes so here on the top of the screen we create a route So this is an object we define a pattern a pattern is about static segments and variables We have slash node slash ID ID can be anything actually and the second argument is an array of Arguments it can be whatever you want and here I have defined a controller Which is a method on on a class that needs to be called for this route This is just a convention and then we have a route collection So this is an object. It is a glorified array really and we store all the routes in there And as you can see each route as a name a unique name here note Then you can create what we call URL matcher and this object is able to match a request a path for the request and it returns an array of attributes so if we Match slash node slash 12 for instance it matches our route So the return array Contains underscore route which is the route name the ID This is the place all during the pattern and the underscore controller, which is what we have defined in the route definition Right, so this is only half of the story, right? This is only about matching incoming request and have enough information about a request to be able to know which Controller which code that unders the request But the symphony routing component also take care of the other way how you need to generate some URLs So whenever you want to link to a page instead of our coding The URL in the page you give symphony the route name the unique route name and all the arguments you want to pass to it for instance a node ID and Symphony will generate the URL for you. It means that as you never ever Artcode a URL in your code you can change route patterns Whenever you want without changing anything in your code everything will still work as expected, right? so there is a clear separation between Defining your routes and using them right because there is this abstraction which is the route unique name So to sum up the symphony routing component decouples the look of the URLs Which is quite important from the code that actually handle them the event spatter component is Similar to the Drupal hook system, right? The biggest difference again being that even spatter is an object-oriented way of doing the same thing I don't know if Drupal 8 is going to use even spatter to replace the current hook system I think it won't actually not yet not in Drupal 8, but at least Drupal is going to use the event spatter because of the symphony HP kernel component And I will talk about that in a minute so First you need to create a dispatcher the dispatcher is the central object of the event spatter system and your code dispatches events to the dispatcher and the dispatcher notifies registered listeners For the event and each listener can do something about the event, right? So as you can see here each event as a name even underscore name here on the screen and for And a listener is any valid PHP callable here This is an anonymous function, but it can be any PHP callable and then Somewhere in your code you can dispatch the event you pass an event Object can be a subclass of the default event, of course, and then your listener will be called so the symphony Even spatter component is actually an implementation of the observer design pattern Next up HTTP kernel This is the most important symphony component Why? HTTP foundation is about the representation of the HTTP messages as defined in the HTTP specification HTTP kernel Implements the dynamic part of the HTTP specification It gives the developer a standard way to handle requests and To ensure that the response is sent back to the browser So again The user ask a resource in a browser the browser send a request to the server symphony gives the developer a Request object the developer does something with the request to convert it to a response And then the server sends the response back to the browser the browser display the resource to the user, right? And now this is the most important slide of the presentation because HTTP kernel interface is the only thing you need to implement To make your application your product your project compatible with all the others that also implement this interface So basically it defines just one method and all Which must and their request and convert it to response? And it should do its best to actually ensure that there is a response as a return value So let's talk about the default implementation that Drupal is actually going to use So to make the conversion of a request to a response as flexible as possible the default HTTP kernel interface implementation defines a standard workflow by dispatching events during the handling of a request So the first step when a request comes in the request event is notified and The listeners can do something with this event and a request So it can change a request it can inject some new arguments It can tweak some errors whatever so for instance the routing system is actually a listener on this event, right and if a Listener return, sorry if a listener returns a response We are done right so we go to the last step Which is yet another event the response event and then in this event you can tweak the response the way you want and The response is then sent back to the browser, right? If the request event does not return a response Then we need to find the controller the code that is able to under this Request and for that we have yet another interface, which is the controller resolver interface It has two method the first one get controller And based on the request this method return a PHP callable That can handle the request and the second one is get arguments and based on the request and on the controller It is able to guess which arguments to pass to the controller. So it is really flexible and Drupal is going to use the default implementation So we first resolve the controller based on the request Then there is another event controller so that you can tweak the controller if you want for instance If you want to wrap it with something else that's a possibility then we resolve the arguments and finally We call the controller a controller can be any PHP callable and The contract is that it should return a response object, right? and if it does so then The response event is notified and response is then sent back to the browser if it is not the case then We notify another event named view and the responsibility of the view listeners is to actually try to convert the return value of the controller to response somehow and if this is the case then the response is sent back to the browser and During this handling of a request if there is an exception an exception is not a response This is not a valid response object in this case symphony just catches the exception and notifies an exception even so that Listeners have a chance to actually convert the exception to a response, right and Last but not least after the response is Send back to the client you can listen to the terminate event To do things that do not modify the response of course like sending emails for instance, right? and Yeah, that's I'm going to talk about a sub request thing later on so this is the default workflow In the HTTP kernel Object so we have a request we do something about a request something being we notify events And we call a controller and at the end of the day We want response to be able to send it back to the browser Here you can see a very simple But fully featured framework based on the symphony two components. So we are using the routing system The event spatter the controller resolver the HP kernel So we have I don't know 20 lines of code and I won't you know I don't have time to explain how it works here But trust me this is all you need to create a fully featured framework based on the symphony two components It is even better than that because symphony comes with many built-in listeners you can use out of box So for instance I Told you that whenever there is an exception We have this exception even so that you can convert an exception to response So here is how you can register the default exception list listener It takes a handler handler being a PHP callable and here it is very simple example where I take the exception The response content is just the exception message and the status code is 500 really simple Right and now whenever there's an exception somewhere in your code It would be catched and convert it to response Right, of course, this is probably not what you want because it's too simple And in the development environment It can be useful to have more information about the exception the stack trace for instance And for that we have an object named exception handler And if you do that whenever there's an exception, this is the screen you would have You know you have all the exception the previous exception if you have some and the stack trace So you have all the information so that you can debug your code So to sum up the default HTTP kernel implementation makes Drupal interoperable With any other software using the same implementation But there is more One of the biggest problem when using a plan PHP for the HTTP request and response is that the code is not Testable right, but thanks to the simple HTTP kernel contract. I give you a request And you give me the associated response. It is really easy to write functional test for your code. This is an example We have an object named client you give it a kernel the kernel is the HTTP kernel instance And then you can simulate some request here. I simulate a get on the slash L O such Fabian Path and then I can get a response from the client and do some assertions here I check that the status code is actually 200, right But there is more Because the client returns what we call a crawler a crawler is like jQuery but on the server side right and On the crawler you can filter the response which is probably some kind of HTML page, right? And here I filter with a CSS selector So I want to check that there is h1 tag with fabian inside, right? And then it returns an array of nodes and I'm just checking that there is one such node Pretty cool. So even if it looks really simple. We have leveraged many symphony components HTTP kernel HTTP foundation dumb crawler browser kit CSS selector even the spatcher. I think that's all Right, but for you, this is really simple news Most frameworks and applications out there have some kind of caching mechanisms, right? And most of the time the caching layer is done at the application level and that's wrong Symphony does not provide any caching layer for your web pages But instead it relays again on the HTTP Specification on the HTTP cache editors It has a lot of benefits first if you know how HTTP caching works You already know how to configure the symphony cache system And if not you should probably now learn how HTTP caching works as this is probably something you will need at some point anyway So let's see what I'm talking about the HTTP specification Specification defines two different caching models. The first one exploration is really simple You specify how long a response should be considered fresh by including the cache control and or the expires header, right and caches that understand exploration Caches can be a reverse proxy or proxy or your browser cache actually So caches that understand exploration will not make the same request Until the cached version reaches its exploration time and becomes stale, right? So exploration allows you to scale as less request actually eat your application Exploration is simple enough, but unfortunately there are many situations where it does not make sense Because you know you have some kind of heavily dynamic website or page and in this case the validation model Is better and then you can use the e-tag or the last modified header and our request Eat the server because this is the validation model, but validation says bond with This is how you can configure cache headers in symphony so you can set the TTL for instance, so this is Just a wrapper on top of the cache headers you have in the HTTP specification The first example is how you can configure a reverse proxy The second one is how you can tell the browser to keep the page for 10 seconds, right? And even when using the HTTP validation model, you can save some CPU and memory if you are Smart enough so first based on the request you need to get the last modified Value as fast as possible so you can probably store that in memcached e or redis or whatever And you set the value on a response object, then you call the is not modified error function method on the response Symphony does something with the request on the response And if it is not modified then it converts your response to a three or four Which means that you can return the response directly to browser if not then you can do the expensive work, right? Okay, and everything is defined actually in the HTTP specification return more than 10 years ago So why would you want to reinvent the wheel does not make sense? Last but not the least you can also use both the validation model and the exploration model for one single page That way you can for instance cache a page for a short period of time Let's say 10 seconds. I think most of the pages can be cashed for 10 seconds and every 10 seconds the page is Validated right so this is the best of both worlds and the goal being to never ever generate the same response twice Then with a single line of code you can activate a symphony HTTP caching feature So we have this HTTP cache header and it wraps the kernel That's all done. It works, right? And as a matter of fact HTTP cache is actually a reverse proxy implemented in plain PHP Right, which means that if you can afford it you can also install varnish for instance, which is an HTTP reverse proxy exactly the same as a symphony one but written in C and Your application will scale even more. I mean either more than that And this is just incredible What you can achieve with a single instance of varnish so just because we are relying on a standard HTTP we can install varnish, which is a C software and it will be our cache mechanism You can't do that if you have a proprietary caching system So using the default HTTP kernel allows Drupal to benefit from the many built-in features we have in symphony Right, okay. There is more of course speaking of great features you have for free I want to talk about ESI edge side includes because you know, what if you cannot cache all pages, right? If we are using HTTP cache headers, it means that you are caching the whole page or nothing Which is not good What if your pages have some more? Dynamic parts, what if you have you know a stupid Twitter feed in your page? In this case you can use a technology called edge side includes and it has been defined by Akamai Let's take an example YouTube this page So they have a lot of traffic right This page is mostly static except for this pot because if you are Connected then it is different right in this case you can probably use HTTP validation for instance or exploration based on Which user is actually logged in right and if you have a look at the column here in the middle This is a trending Videos and They are not updated every single minute, right? They are probably updated every hour every two hours, whatever so for this part of the page We can probably use HP exploration right, but to be able to use HCP headers you need a request and you need a response, right? So you can't do that with one page you actually need three of them one for the main page and Two for the embed pages right and this is how it is solved with ESI Instead of including the content directly into the main page. What you do is you add These ESI include tag right so instead of the content You have just one tag and the source is actually the URL for the embed content, right? This is why you can have some request here in the process in the workflow Because when you are rendering a page you can say okay for this content I want to actually use a sub request if I have a sub request I have a sub response if I have a sub response I have caching headers So I can have a different caching strategy for this unbed content And of course now for the main page and can also use some cache headers So I can also use STP HCP exploration so I can use caching for all the content of the page right this is how it works You have a browser you have reverse proxy cache and then you have your application. I make a Request flash foo. There's nothing in the cache. So it it's my application. It returns something with a cache Header cache control so I can catch this page for ten minutes And as you can see there is this ESI include tag because I am using a reverse proxy that understands ESI Which is the case for the symphony HCP cache class and for vanish also The reverse proxy makes an additional request for This page for the sub page right it returns something as you can see we have also a cache control header Which means that we can catch this page for five seconds. We store This page in the cache The reverse proxy Assemble everything into a single page and the page is sent back to the browser which means that as far as the browser is concerned This is the same page as before No change right and before exploration Sorry So before exploration The reverse proxy can do everything by itself But when the sub request expires then instead of getting the whole page it can just get the sub request and then Done right and configuring it is really easy You just need to add this object new ESI and then symphony will automatically Configure ESI for you really simple right and of course again if you can afford to install varnish It would be even better So to sum up the symphony HCP kernel component Provides the building blocks to create flexible extensible and scalable HCP based frameworks and The component leverages the HCP specification to make integration between projects really easy So Today I have you know one hour is really short So it was just the gist of the symphony components if you want to learn more you can have a look at the symphony.com slash components page. We have a bunch of documentation you can ask questions mailing lists on on IRC or whatever if you want to learn more you can have a look at selects Which is a macro framework based on the symphony two components and it is really easy to understand because it is really just about 10 classes and it implements everything you want to know You can also if you want to build your own framework, which is a possibility with the symphony two components You can read a series of articles I wrote earlier this year. So this is the the page where you can go to have the first the series of articles and If you want to know more if you want to learn more about symphony if you want to meet the symphony Community you are invited to the next symphony live conference. So you are more than welcome to come to the conference We have one in Paris in June, which is the biggest conference For symphony and we also have one in the US in September in San Francisco So if you want to know more about that you can go to the website live.symphony.com so Just if you want to learn if you want to keep something from this session This is this the symphony components Provide the Lolliver building blocks the Lolliver architecture that you need to build a website any website to build a web product So that you you all you can focus on what matters Most for Drupal Everything else we are in charge Thank you, okay, we have exactly one minute for questions Hey As a module developer and a site developer I'm curious how much of an impact will this have on people who are not Directly contributing to core will this affect a lot of general module development or is this more strictly core focused in Drupal? Yeah, probably actually Larry is the right person to answer that But I think the general approach is to try to limit it as much as possible Most of this is very low level and eventually maybe it will start to trickle up a little bit But for the most part it should be fairly hidden Okay, since it's recorded I'll repeat so the big shift is that page page callbacks will change Okay, they will turn into object controllers So I guess one more question The page the crawler that you get back from the request object or whatever it can parse HTML Can it do anything else or is it extensible? So basically it's I mean this is basically the helper class that that gives you CSS selectors on top of HTML Or any markup language for that matter Okay, so thank you