 Hi everyone Sorry for being a bit late. I was talking with Nate about backdrop and the fact that you really love symphony Which is a cool news for me so So today I want to talk a bit about symphony. I'm this is not a very technical talk I want instead I want to talk about the problems symphony tries to solve and Why I think that Drupal actually took the right decision when Driz and many other core developers decided to reuse some of our work and At the end I'm going to talk about my tech on Drupal 8 and the backdrop thing and and what I think the community should do Okay, so first what is a symphony and where does it come from so I started to work on symphony seven years ago At that time I was working for a web agency. I created almost 15 years ago and it was really created to solve problems for our customers So that was seven years ago and three years ago. I decided to start from scratch and and start working on symphony version 2 And I had several goals in mind. The first goal was to be useful for companies wanting to create Custom solutions for their projects, but I also wanted to create the best platform possible to build other open source projects so the main asset of symphony is a set of components we have about 30 plus PHP components nowadays and each component tries to solve a common web development problem that you can face when creating a website It's really just about the lower ever architecture of a website. We are not Giving you any business logic. We are not trying to solve business logic problems. So we don't have any CMS components Or Sharon stuff or whatever. It's really just about the lower ever architecture of what you can do with PHP And it's kind of interesting to understand that those components Borrow a lot of ideas a lot of best practices Concepts and design patterns from other languages like Python Ruby and even Java and also from other Technologies and other frameworks like Django in in Python Spring in Java and a few more So it's not symphony is not a new way of doing things. It's not Something that you need to learn because of symphony symphony is just an implementation of some other best practices as our design patterns that already exist and stuff that Really work on other technologies. So we Adapted those techniques to the PHP world, of course So there is the full list of the symphony components And again, it's it's really just about the boring stuff How to write a console application how to read a YAML file how to write a YAML file how to translate stuff How to use internalization and so on. I'm not going to talk about all of them. I'm going to talk about a few of them So some of the components are tools and Basically each of them Does only one task it solves one simple problem And that's all and they don't have any external dependencies So the first one I want to talk about is the finder so the finder come I'm not going to talk about how to install the components because nowadays with composer. It's really easy Just add a symphony slash finder to your composer the JSON file and and your dog So the finder is a way to be able to find files and directories on the file system or Online so it also works with Amazon F3 works with FTP servers, whatever whenever you can Store files and directories you can use the finder to get them back and you can filter the result By date by name by size Or you can even use an anonymous function to implement your own logic to filter the the files you want The second one is the CSS selector. This one is quite interesting if you are writing test functional test for your website So you get a URL and you get back an HTML page and you need to check that the HTML page page is behaving the right way that the content is actually the right one and The way you can do that by default you can use regular expressions, but that's quite limiting and it's not really easy to adapt if you know the design Changes over time You can use XPath that's the default way of doing that with HTML or XML documents really Or you can use CSS selector and I think that you know most of you probably knows about CSS selector And it's much easier to write a CSS selector than it is to write an XPath Expression so the goal of this component is to take a CSS selector and to convert it to an XPath expression So the API is the API is really simple. We only have one method, which is the two XPath one So that's very useful if you want to do some functional testing and I'm going to show you an example later on The debug component provides tools to actually is the debugging of PHP code And again, it's really easy to use you just have to call this method enable somewhere in your code and then It automatically register an error handler and an exception handler And whenever there is a PHP error or a PHP exception, it tries to give you better exceptions than the default of The PHP defaults. So this is an example. It's quite small but The idea is that beside the exception message or the error message It gives you a stack trace and you can even configure the component so that you can click on the file names and automatically open your favorite editor or IDE And It also tries to be smaller than PHP when it comes to error messages. So this one is about Yeah, so you try to Load the class finder from the global namespace. So apparently you Forgot to use a use statement because this is a class that is in a specific namespace So instead of just trying I'm not able to get the finder class It tells you that you forgot to add a use statement And it also tells you that you probably want to use symphony component finder finder So we try to help you as much as possible when there is an error The entl component is is a very boring one really but very useful So, you know that in PHP by default there is an entl module That helps with internalization of your website but unfortunately a lot of PHP packages on different Linux Version they don't provide entl by default and in this case You can use the entl symphony component, which is a replacement a PHP replacement for the C extension And if you are using composer you have nothing to do It will be automatically activated if the PHP extension is not there It does a bit more than that because it also exposes a lot of information from the ICU library So you can get languages region currencies and a lot more information about Stuff that are available in the ICU library So that's about the components The tools we have in the components. So each tool does just one job. It's easy to integrate A tool in your project and most of the time the IPI is just about one Method one class and one method so we have tools we also have Some frameworks and those frameworks are more involving because they are doing more than just one thing But the benefits are also I hope because if you are using them then you are able to share code You can you you will probably be able to integrate more features Faster and it's also a great way to be interoperable with other project that are also using the same components I'm going to talk about one HTTP kernel later on Okay, so symphony is a set of components that you can use for a project. It's also a full stack framework That you can use to create a custom application and Drupal Drupal version 8 is not using the full stack framework It's using the components to build a framework on top of the symphony component Last but not least symphonies open source like Drupal it's using the MIT license Which is very permissive. So basically you can do whatever you want you can integrate Symphony in any kind of projects even projects using the GP a license like Drupal I like to think of symphony as being a middleware for PHP applications and Object-oriented middleware for for PHP and that's the key point you know even if PHP gives you all the tools to create object-oriented code its core is still mainly done with Plain functions, right? You have a bunch of functions and if you have a look at all the classes provided by the PHP core They are not web-related. They are not related to the web So symphony is a layer on top of PHP to provide an object-oriented Abstraction for everything related to PHP to the web. Sorry So the first framework I want to talk about is HTTP foundation Which is an abstraction on top of the HTTP specification And of course as web developers you are all using HTTP You are using HTTP all the time and symphony tries to leverage HTTP as much as possible so How do you represent a request? This is a typical request here on the screen As you can see HTTP is a plain text protocol Here I want to get the foo.html resource. I want to use HTTP version 1.1 and the host is example.com pretty simple and how do you represent this request in PHP? Like this you don't really represent a request you just get information by calling Functions like you know sessions start to be able to get stuff from the session And it's mainly about global variables, right? And that works really well. You can get stuff from the query string From a post you can get the method of the of the of the request and so on But the thing is it that's only a very low level abstraction and Here is an example If you want to get the client IP address you can get the remote underscore a ddr Item from the server global variable, right? That's how you can do that The problem is that it's not secure. This information is coming from From the request so if you want to get the real IP address from the client because you know between the client and the server you can have proxies you can have proxies Installed by an ASP you can have reverse proxies So if you want to get the real client IP address by taking into account all those proxies The code is more complex. This is what you need to write And actually this is really a stripped-down version of what you need to write to get the real IP address of the client and the code is not even secure if you want if you want to get the real IP address or The best approximation for the IP address of the client you need to Know which reverse proxy you are actually trusting right you can't you cannot blindly trust all the reverse proxy along the way so That's why I'm saying that you know by default PHP provides a very low level Low level abstraction on top of the HTTP request message And if you want to get the code right then you need to write a lot of boilerplate code So why not sharing this code in one? abstraction So using plain PHP Is just a pain first because it's not object-oriented The fact that it's not object-oriented as a lot of you know consequences really And the first one is that it acts as a singleton a singleton being you know something that you can have just one instant off It means that if you want to test if you want to functional test your website you only have You know one request you can't have more than one request in one PHP process And that's a problem when you want to simulate a request for testing So this is big limitation and of course you can easily override the underscore get or the underscore post global variables That it's not be deal, but when it comes to overriding the underscore server global variable That's get really difficult So that's a lot of our abstraction only I've talked about that before And and and that's that's a very big problem if you are if you want to create secure applications Okay, if we have a look at How you can do the exact same thing with Symphony So in Symphony you can create a request from the global variables This is the first the second line here or you can simulate any request by calling the create method on the request object So here I want to simulate a get slash a lot of HTML request I don't care about the values coming from the global variables And you can even be compatible with the code that is still using the old way by overriding the global variables and Symphony is Going to have read all the underscore get underscore post and underscore server based on the information you gave to it with the create method here and Then you have you know the request class exposes all the information that are Useful from the HTTP request In a semantic and secure way So when you when we get the client IP you will get back the real User client IP address and of course you can trust some proxies to get a better approximation of the real IP address and the same goes for the response again the HTTP response is plain text so it's kind of easy to understand here we say that we we Answered with an HTTP 1.1 Message 200 means that the response is okay We have a bunch of errors and then we have the payload the body what is going to be displayed in the browser and PHP gives you Methods to be able to generate a response To generate headers to set cookies and if you want to add something to the payload you just call echo or print All right Okay, so like for the request PHP works In a way that you can only generate one response You cannot generate more than one response in a single PHP process Which you know most of the time that's fine But when we are talking about testing your application if you want to simulate more than one request in a PHP process Then that doesn't work that well So it makes testing more difficult than it should be So singleton like again lower abstraction only Doesn't work on on the command line doesn't play well with the command line interface because By default PHP Assumes that if you are on the command line It probably means that you are not Dealing with the request and you are not going to generate a response which means that for instance in PHP There is a function named Edders underscore least which returns a list of headers that you set in your script Except that if you do that on the console It will always return an empty array Which is a shame, right? and If you want to get the HTTP status code that you set in a response It's just not possible on the command line. I mean it's not it It has become possible as of PHP 5.4 thanks to a new HTTP and the score response and the support core code function. So And last but not least it's not object oriented But I think it that's the least important stuff the fact that Symphony provides an object oriented way of creating a response is just a nice Consequence of what we want to be able to achieve with a response the fact that we want to be able to have more than one response So as you might I have guessed we have this response class You can create a response the first argument of the response constructor is the body then you have the status code and then an array of Edders right and then you can send Set the content and sent the response back to the browser And of course you can only call sent once but you can introspect the response whenever you want We also Support stream responses because that's one thing that PHP does really well as you can use just headers and error calls and echo by default PHP is able to stream the response back to the browser when you are using an object That's not really possible anymore because you create the object You populate the object with Edders and the content and at some point you need to send the request the stream response class is a way to Be able to stream a response back without Creating a response first So the request and the response object are totally independent you can use just a request You can use just a response, but if you are using both them then you must know that you know in the HTTP specification There are a lot of stuff that Yeah, sorry, so Creating a response sometimes depends on the request for instance if you want If you don't get a resource, but if you want to get the head of the request then the body should be empty and the prepare method does exactly that it check the request headers and Depending on the values of those headers it tweaks the response so that it actually Respect the HTTP specification So to sum up the HTTP foundation component abstract the HTTP messages and gives you If an object oriented layer that allows you to test things more easily And gives you access to more secure Code Okay The next thing I want to talk about is innovation. So Simply tries to innovate a lot in the PHP world We were the first to actually Introduce a dependency injection container in the PHP world. Sorry about that But we also have a lot of debugging tools and we were the first to add What we call the web debug toolbar and basically when you are in the development environment You have access on all HTML pages at the bottom of the page you have these tool bar and gives you a lot of information about the current request and hide behave And nowadays all the major frameworks also have the same kind of tool The interesting thing is that you can also click on each of the item here You get into what we call the web profiler and the web profiler gives you a lot of information about the request about the response and What? Happened during the the handling of the request and these two Will be available in Drupal 8 I have a small module integrating this web profiler and the web developer into Drupal 8 It's not I Did the work probably six month ago So it doesn't work anymore for the current version of Drupal 8 But it should be easier nowadays to integrate that and it was six months ago So that's something that you will we will be able to share with you Another game changer for me is twig Collect a real time playing system because you know, I think that PHP is not really a very good PHP template system not going to talk about that today because I already talked about that yesterday And no one is nowadays there are so many other project that are using or switching to tweak that You know, if you learn tweak You will be able to use this knowledge with many other different Projects even project not written in PHP because it's in text itself the language itself is shared with Other libraries that you can find in Ruby and Python. So the syntax itself is Becoming a standard really, okay, I need to talk about dependency injection I'm not going to dive deep into what dependency injection is or what a dependency injection container is When I was working on symphony version to the very first prototypes I Had a bunch of problems and one of them was how can I make things more? Flexible, how can we allow people to remove some parts and replace them with other ones? It was kind of important to be able to decouple all the components that we had to be sure that you can use just one Component or the other one without any interaction and if you get them together they can interact in various ways So Dependency injection. I think that this design pattern is probably one of the easiest to understand The name of the pattern is kind of scary But it's really easy to understand if you know what object-oriented programming is The container is not something that you really need to be aware of most of the time. This is really the law-abiding stuff And and you will probably never interact with the container directly in Drupal 8 if you need to interact with the dependency injection container in Drupal 8 for day-to-day activities It means that there is something wrong somewhere and that needs to be fixed So as you yeah, you might have guessed that Drupal 8 is going to use the symphony container If we have a look at the community So symphony we have about 850 core developers Which is a lot for a PHP project, but nothing if we compare to Drupal. I think you have almost twice as Twice this number for Drupal 8 nowadays. So still that's a lot We have a very active community We the community created more than 2,000 bundles in the last year and a half. So that's that's really a lot and We have almost one million downloads every single month. So that's a very big project really The last thing I want to say about symphony is that you know symphony is not a black box It is just plain PHP code Code that you can probably read that you can probably understand But most important the symphony code is just about Implementing best practices and design patterns and standards really like HGP It means that if you want to learn symphony It's more about learning those standards those best practices and and less about learning something specific to symphony Or the implementation details of the symphony code Most of the concepts that you are going to learn are Really concept that are not tied to symphony. So if you already know about these standards like HTTP dependency injection Learning symphony is really easy. And if not then Well, you will have you will be able to apply your new knowledge to other in other technology Technologies or even in other languages So that was about symphony what it is And and why I think this is a good idea to reuse some of the components that we have But now is symphony good for your open source project So as I said before it was one of my goal to be able to provide a platform that is a good tool For all their open source projects. So I'm very happy that it actually happened For me, there are four key points The first one is Symphony allows you to standardize your low lever architecture. So let's symphony do the boring stuff There is no need to reinvent the wheel here There is no need to reinvent a new way to abstract the request to abstract a response or stuff like that So that if you spend less time on this low lever architecture, it means that you will have more time to focus on The core features that you need that your users need All the business logic that you can implement for your users like the mobile HTML 5 We see we get it or whatever Things that will make Drupal a Great tool for new users And I think that you know symphony is just an implementation detail Then if you are using symphony means that it will be easier to integrate with other products also using symphony And we are working out trying to convince other open source projects to actually adopt some of the symphony components so that We are we will be able to have a more interoperable PHP platform for everyone and also because more people will be able to understand your code you will have a larger pool of developers Helping you with the code also because we don't have a CMS in the symphony world anyway So interoperability and integration is possible because Drupal is not the only project using symphony There are many other different projects. I've just So this slide is just about a few of them the main ones probably So we have big project. We have small project. We have CRM systems. We have CMSs We have our own tools. We also have other frameworks using some of the symphony components. So a lot of different kind of projects Drupal is not using all the symphony components, but quite a few of them really and The last one I want to talk about today is HTTP kernel because this is probably the most important symphony component that we have and this is Because of HTTP kernel that Projects using symphony are interoperable actually. So I like to think of HTTP kernel as being The equivalent of frac in the Ruby world or WSGI in the Python world And it's if it's not exactly the same as PHP The core of PHP takes care of a lot of details and and and the bridge between the language itself and and the web server But still it's about standardizing the HTTP protocol and the way we interact with the HTTP protocol and the symphony HTTP kernel components provides The building block to create flexible extensible unscalable HTTP based frameworks So HTTP foundation is about the representation of HTTP messages as defined in the HTTP specification and HTTP kernel is the dynamic part of the specification it gives the developer a standard way to under request do something about the request and I'm sure that the response is sent back to the browser and The most important file class interface in symphony and the HTTP kernel component is probably in HTTP kernel interface is a very simple one One method and all it takes a request as an argument You need to implement it and then you need to return a response at the end and just because of this One method all the projects using HTTP kernel are interoperable and you can you know Create bridges between them. So let's see how it works in practice. So if you have a look at Drupal The symphony food stack framework is he published or and a bunch of other ones You will see something like that. We create an HTTP kernel Whatever it is. It is just a kernel Implaining implementing the HTTP kernel interface You create a request from the global variables and you ask the kernel to under the request and then you send the response back to the browser It is that simple, but just because you are using this pattern. It means that a lot of things become really easier and one of the biggest problem when using plain PHP for HTTP is that the code is very testable, but thanks to the HTTP kernel interface it becomes really easy to write functional test and In the HTTP kernel Component we have a client class. So the client class simulates a browser really So you pass it a kernel and then you can simulate requests here. I want to simulate a get slash a low slash Fabian request Then you can get the response and you can check whatever you want on the response here I'm Checking that the status code is actually 200 But there is more if you have access to the CSS selector component I've talked about before you can filter so actually the request method return a crawler The crawler is like jQuery for PHP and then you can filter the response with a CSS selector And then do whatever you want with the nodes here. I'm checking that there is one h1 Tag on the page containing Fabian, right really easy It also means if you are using HTTP kernel interface, it means that you can also leverage HTTP caching Not going to talk about that because I'm running out of time here, but Most of the time, you know the caching layer created on You know various cmses and frameworks are Proprietary really we reinvent the wheel, but if you have a look at the HTTP specification You will see that you have everything you need to create a good caching strategy written in the HTTP specification so The HTTP specification defines two different caching models exploration and validation exploration allows you to specify How long a response should be considered fresh? And validation is a bit more complex and it means that every time the server actually Validates that the cache is still valid and the great thing is that you can still use Exploration and validation in the same request meaning that you can say okay this response can be cached for 10 seconds for instance and Every 10 seconds we validate that the cache is still fresh So you can mix and match and exploration always wins over validation so the goal of a Good HTTP caching strategy is to never ever generate the same response twice So as everything is based on HTTP it means that setting the HTTP caching strategy is just As simple as setting some headers on the HTTP response But we also provide an abstraction for the most Common cases like setting a TTL Which is a way to say I want to expire this page in 10 seconds for instance And Even if when using the HTTP validation model You can also save some CPU by not generating the whole response if you are able to actually say that the response is not modified With so this is kind of what you need to write to Check that the response is always the same you can return a 304 as fast as possible without generating the all response And using the HTTP cache layer in symphony is really simple you can just wrap your kernel with the HTTP cache Class and the store is where you want to store and the cash. That's really easy and As we are leveraging HTTP and the HTTP cache headers It means that instead of using the HTTP cache class, which is really just an implementation of a reverse proxy written in PHP You can also use any reverse proxy Like varnish for instance So if you are using varnish, then your application is going to scale even better because the cache the cache layer is going to be Endowed by varnish with which is really fast And so in Drupal you are not only using the HTTP kernel interface you are also using the HTTP kernel the default HTTP kernel implementation and it's even better because we provide a bunch of workflow from the request to the response where you can hook in and do stuff do interesting stuff again I'm not going to talk about this workflow in great details because you can find a lot of information online a lot of Documentation videos whatever so if you want to know more there are plenty of documentation online but the thing is as This is standardized again, you will be able to leverage a bunch of Features that comes built in with the HTTP kernel component Last but not the least we also support edge side includes ESI and Supporting ESI is only possible because we are able to actually handle more than one request and generate more than one response in one PHP process, so Drupal 8 is not Able to handle ESI tags yet because of technical problems because we are not it's not finished yet, but the goal is to be able to use ESI in In in Drupal 8 also Also want to talk about Predictability and that's something really important and when you choose Symphony for your open source project. It's not just about the code It's also about the way we manage a project in a very predictable way And that's also a big plus Of course as you are unbending a third-party Code it means that from time to time you need to upgrade you need to update the code to the last version so being able to Know when a new release is going to happen can help a lot and we have a clear roadmap That you can easily Follow so there is a new Symphony release every six months No matter what every six months at the end of November and May we have a new release and We have a new long-term support release every two years a Long-term support release comes with three years of maintenance and four years of security issue fixes And we work out to keep backward compatibility between all the major releases As an example if you have a look at twig we released twig version 1.0 a year and a half ago two years and a half ago And we did not break backward compatibility since then so in two years and a half With more than I think 36 releases we did not break back by compatibility That's something really important for us because we know that a lot of different opens of project actually rely on our code So we can't break back by compatibility because if we do that we are going to break a bunch of code Talking about security issues also we have very well defined an open process So we work closely with the Drupal security team To synchronize our security releases that that's not happening right now, but it's going to happen when The stable version of Drupal is going to be released So those are just example of what we do to ease the work of our users Be they big companies or open source projects. I Want to finish my talk with my take on on Drupal 8 and the current situation of Drupal 8 I'm an outsider here. So please take my words with a grain of salt. I'm aware of the recent Drupal fork I've talked with Nate just before this talk I'm aware that some people don't like symphony I'm aware that you struggle with a lot of things But I'm pretty sure that Most of the problems that you have now are not really related to symphony But more about how you are using symphony and or how you are transitioning from the old Way of doing things to the new way of doing things and the good news is that I'm convinced that the vast majority of The problems you have are fixable I'm not saying that it's not it's it's it's going to be easy. I'm not I'm pretty sure that it's going to take time, but it's still doable And I'm sure that you won't regret that move in a year or two And of course if you need help and I think you need help We are you're to help the symphony community is ear to help. So We want to play to be a huge success. We need to play to be a huge success So let me show you my experience and my vision about, you know, the current programming world and the state of things in PHP I Think you know developers Need to embrace changes because the web evolves at a very fast pace and You know, if you don't want to learn new things if you don't want to adapt yourself to the new way of doing things if you don't want to learn How things works in other technologies in other languages If you don't want to reinvent yourself on a regular basis, I think that's you know, you really need to look for another job But at the same time and bracing changes is really out and that's the real challenge There is a pattern. I've seen often in the last few years and you know, it all starts when you Discover a new way of doing something You discover a new pattern a new best practice and You start using it to solve one problem and you find it beautiful Powerful or just better than the other and the other way You don't really understand why but you have this feeling that you You've just got to the next level really and Then all of a sudden you want to use it everywhere And it soon becomes, you know, the way to fix all Problems, but at some point you realize that It's not the silver bullet It does not help fixing all the problems you have it's like, you know, I have two kids and When I come back from a conference most of the time I have a small gift for them so they have this new toy and It's great. It's wonderful and they want to Play with this new toy and all the old ones They're not, you know, so old obsolete And it lasts for two or three days a week depending on on the toy And at some point they realize that the new toy is great, but the old ones are also great So they start using and playing with all their toys. I think this is the exact same thing here so And Here I'm talking about object-oriented programming. I'm talking about the MVC pattern. I'm talking about dependence injection I'm talking about all the new programming concepts introduced in Drupal 8 and all those new concepts are not the answers to all the problems far from it I'm even going to say that Using them everywhere in Drupal 8 is a mistake Would be a mistake actually It would be really bad for Drupal so you need to find the right balance between a Beautiful design and a practical one and that's really tough You need to understand when to use the new tools you have at your disposal You need to be able to migrate one step at a time to be sure that you don't overdo things and to be sure that you don't rewrite everything in one go and Knowing when to stop the refactoring understanding where to apply This pattern is really odd It probably took us the symphony community about two years To really understand when and how to use dependency injection When to use the container in symphony when to inject the container when not to inject the container We even removed some of the features that we added in the container at some point because we realized that Even if it was a good idea in the Java world It did not make any sense in the PHP world, but it takes time and That's some knowledge that we have and and we want to share that with you And you know Using some PHP functions, that's fine. No big deal. Not a problem. And if you want to replace all the functions with Static method calls. Hmm. I think that's not a good idea. It doesn't make really sense Not always actually Creating a class without an interface. That's fine. Even if a lot of people are going to sell you the contrary Hey, we are using PHP right PHP is probably the worst language ever created So if you are Serious about programming anyway use Java use least but not PHP, right? We are using PHP because it's the best way for us to get the job done right and We don't code For the code, right? Coding for the code is really a bad idea. We code because we want to solve problems We are coding to simplify people life, right? And Symphony is just a set of tools Symphony is not Drupal 8. I will even say that for most people Symphony should be hidden This is just an implementation detail Symphony solves the Lolliver architecture of Drupal And it should simplify the life of Core developers But it should not get in the way of regular Drupal developers and in the next coming month, we need to work together to find this right balance And again, we are here to share our experience. We are here to help That's all for today. Thank you