Drupal 8 Development Mastery (10): New 3rd Party libraries: Guzzle, EasyRDF, Zend_Feed

Here, in quick succession, I will introduce three of the standard third-party libraries that were adopted in Drupal 8 to replace its previous custom solutions, as well as references to learn more. These are Guzzle, EasyRDF and Zend Feed.

Drupal 8 Development Mastery: New 3rd Party libraries: Guzzle, EasyRDF, Zend_Feed

Please, note that the topics of this part is not critical to the limited Drupal 8 development mastery goal we set for this series. I included them for completeness purposes, so we get a rounded sense of what Drupal 8 is composed of. So you may skip any deeper exploration of the references.

Prior to Drupal 8, Drupal had taken on all kinds of responsibilities by creating it own custom solutions. In Drupal 8, however, a different approach was taken. Drupal 8 outsources the responsibilities for certain functionality where it was decided that better solutions exists elsewhere.

It is quite noble, after years of resistance, for Drupal to accept that some of its core solutions has better alternatives out there in the wider PHP community. These alternatives largely follows recommended standards and best practices. So it makes a lot of sense for Drupal to switch to them,  instead of reinventing the wheel for already established solutions.

Three of such solutions are third-party libraries that were chosen to replaces their Drupal-specific counterparts. These are Guzzle, EasyRDF and Zend_Feed. I will briefly describe each of them, state the particular Drupal functionality they replaced in Drupal 8 and give references to more detailed information.

Guzzle

Officially, Guzzle is "a PHP HTTP client and framework for building RESTful web service clients". So what does that mean? Normally, you would access a website (sending HTTP requests) through a browser (FireFox, Chrome, Safari, IE, etc). What if you want to do the same thing from within your PHP code? You would use an HTTP client. An HTTP client that comes with your PHP installation is cURL. But it's not easy to use.

So Guzzle is robust PHP library that makes it possible to send and consume HTTP requests/responses in an easy object-oriented way. You can build Web Services and API applications around it. It is also useful if you are into scraping websites data.

Guzzle was adopted by Drupal 8 to replace it's own custom solution in the form of the drupal_http_request() function.

References:

http://guzzle3.readthedocs.org/
http://guzzle3.readthedocs.org/getting-started/overview.html
http://vegibit.com/what-is-guzzle-php/

EasyRDF

RDF stands for Resource Description Framework. It is a W3C standard for modeling and sharing distributed knowledge. In plain language, it is a way of packaging pieces of information so that it makes sense to other applications or machines, as opposed to humans (semantic web). In this way applications/machines can communicate meanings among themselves without human intervention. It works by putting tags on words and phrases in a standard and meaningful way so that certain applications can read meaning from them.

EasyRDF is third-party solution that is adopted by Drupal 8 for it's out-of-the box semantic web solution. It is a PHP library designed to make it easy to consume and produce RDF tags.

Reference:

http://www.easyrdf.org/

Zend_Feed

Prior to Drupal 8, Drupal had adopted custom (Drupal-only) solutions for handling RSS feeds in various places (Core RSS generator, the Aggregator module, in addition to the Views RSS plugin). These solutions were not optimal and adopted non-standard approaches.

Drupal 8 had opted for the more robust, widely used and standardized third-party solution, Zend Feed. Zend Feed is a component of the Zend PHP Framework (similar to Symfony Framework). It provides the functionality for consuming RSS and Atom feeds.

Reference:

http://framework.zend.com/manual/2.0/en/modules/zend.feed.introduction.html

Next: Drupal 8 Development Mastery (11): Composer

Categories: 

Add new comment