Skip to main content

Drupal 8 with Symfony2

And here, I am set for Drupal 8. But wait ... Symfony2 ?? Now who's this ?? We shouldn't ignore

somebody who meets us on our way, right ? So, let's have a short introduction.

What is Symfony2 ?

symfony.com states that Symfony is a set of PHP Components, a Web Application framework, a

Philosophy, and a Community — all working together in harmony.

I am not a Symfony Developer yet what I understand about it is that Symfony is a PHP framework

build on top of reusable, decoupled and cohesive symfony components which serves a lot of web

applications. Symfony shares some of the concepts of the MVC pattern--such as layer separation

yet it's more of an HTTP framework--it’s a Request/Response framework focusing on returning a

response in an optimized and effective way.

Why Symfony2 in Drupal 8 ?

Pushing Drupal forward

As the momentum of GoPHP5 was not kept, there was a need in Drupal to start embracing the

changes happening in the wider development communities. For an instance, by converting core

code over to easily-lazy-loaded classes, Drupal can actually reduce memory by not bootstrapping

code we don't need. That makes response time faster, which is very critical for any web service.

Now it's about

Why reinvent the wheel ?

This integration pushes Drupalists to "get off the island" and replace the NIH (Not invented Here)

syndrome with PIE/PFE (Proudly Invented Elsewhere/Proudly Found Elsewhere), using well-
tested & maintained projects from outside the Drupal world. (Source)
So Drupal 8 uses some of Symfony's components which are vital to the system, such as the Http

Foundation component that understands HTTP and offers a nice request and response object

used by the other components.

Symfony uses a service container that can be used to efficiently manage services in the

application. This concept is also known as Dependency Injection. Service container is used later

in code to fetch services, lazy-loaded on the fly.

These were few highlights of Symfony with Drupal 8, still there remains a lot about the individual

symfony components which we will keep learning with time.

I'll be back soon with the routing mechanism in Drupal 8, explaining my understanding "from

request to response".

Till then let's keep learning and sharing :)

Comments

Popular posts from this blog

Drupal 8 ... Bring it on !!

Back after a loooonnggg gap so, need a bang to get started again, isn't it ? Well, I have something in store :) Yet not very comfy with Drupal 7 but does that allow me to keep my friend, Drupal 8 waiting at the door ? Will he really wait for me to be done with Drupal 7 ? Nooo way, he is running in his own pace ... so what are we waiting for friends, need to catch up. So, from here on let's dive into the ocean of Drupal 8. It's about a month or even more, just thinking that it's high time I introduce myself with Drupal 8 or say the other way round ;) Friends, I know most of us might be thinking not to skip steps while climbing up but at times even three dots are enough to define an area, so why not let's get started. We may get stuck, not an issue, will keep adding dots so as to get closer to our perfect structure. Let's begin with the Getting Started guide of drupal.org. Will be back soon with my way of moving ahead with Drupal 8. Till

404 Expenses Not Found !!

Everyone out there on web must have come across "404", "Page Not Found" messages. The most important thing with these 404s is that they will happen, they are inevitable. Before moving into complexities, lets recollect what a 404 error means. In simple words, 404 is that our server is not able to find what we have requested, so it says “Sorry buddy, I give up." in the form of page-not-found messages. Keeping in mind this inevitability of these 404s, you can wonder what problems it can pose to our site and what these 404 errors can cost us. Imagine a website, trying to fetch dynamic resources for each of it's page request, some of which may result in a 404. Such requests, resulting in a 404 on a heavy traffic site can eventually add up to be actually troublesome. Hold on ... there is more to it. Let's see what happens when Drupal comes into picture. Even while serving a 404 page in Drupal, it does the full "bootstrap", l

Request to Response in Drupal 8

Here ? So, I am assuming we have some idea of Symfony2 and it's components used in Drupal 8 by now. Great, let's move ahead. Every web interaction as we know starts with a request and ends with a response, same goes here with Drupal 8. We send a request and receive some response from Drupal but what goes internally ? Let's dive in and find out. Of all the important components of Symfony2 being used in Drupal 8, HTTPKernel and HTTPFoundation plays an important role in handling a page request but this time the proces uses an object oriented way. Ohh.. big names :) Let's know something more about these. HTTPKernel : This component consists of an HTTPKernelInterface which provides a method, handle(). This method accepts $request object as parameter and returns $response object. HTTPFoundation : This component is responsible for creating and managing the $request and $response objects. We can say that, it's an object oriented replacement of sup