Newer Post

Autoloading in Drupal 8

Older Post

The Basics of the PHP Request

The Basics of the PHP Response in Drupal 8

The HTTP request life-cycle begins with a request and ends in a response. As we have already seen, an incoming Request comprises of various moving parts. The HttpFoundation Component abstracts all the complexity into an object-oriented layer comprising two main classes - Request and Response.

A Response object is what Symfony-based web applications return to the client that makes an HTTP request. This process may be quite simple or complex. Large applications have several components that need a way of communicating, and this plays a highly significant role in the request-response process.

In Symfony, this interaction is carried out in an events system managed by the EventDispatcher Component. At several points in an application, events are dispatched, and listeners that have registered actions then act upon them.

The Drupal hook system is as old as the project itself. Through adhering to simple conventions when naming functions, control over the entire system can be achieved. At different points, Drupal invokes certain functions that match a given pattern.

Both systems have been retained in Drupal 8 as they complement each other. For more information on the topic, here are several more blogs on the topic:

We'll help you unleash.

Join the 30,000 developers who subscribe to our newsletter.

Scale your
Development team

We help you execute projects by providing trusted developers who can join your team and immediately start delivering high-quality code.

Hire Developers
code, drupal