SitePoint PHPFine Tuning Drupal Themes with Patterns, Arg and Types (18.8.2014, 16:00 UTC)

In this article, we’ll discuss how you can leverage various Drupal API functions to achieve more fine grained theming. We’ll cover template preprocessing and alter hooks using path patterns, types and args(). We’ll use the arg() function which returns parts of a current Drupal URL path and some pattern matching for instances when you want […]

Continue reading %Fine Tuning Drupal Themes with Patterns, Arg and Types%

labs @ Qandidate.comA new feature toggling library for PHP (18.8.2014, 14:15 UTC)

Adding features to an existing application can seem straightforward, but what if the system you need the feature in is already running in production and the feature needs small bug fixes from time to time? Or what if developing a feature takes longer than a standard release cycle, so it can’t be rolled out yet?

∞ labs @ Permalink

Thomas WeinertFluentDOM + HTML5 (17.8.2014, 12:59 UTC)
HTML 5 is not directly supported by PHPs DOM extension. That means FluentDOM can not understand it, too. But here is a solution. HTML5-PHP is library that can parse HTML5 into a DOM document.

Both libraries use Composer:
"require": {
  "fluentdom/fluentdom": "5.*",
  "masterminds/html5": "2.*"

Read HTML5 into FluentDOM:
$html5 = new Masterminds\HTML5();
$fd = FluentDOM($html5->loadHTML($html));

Or write it:
echo $html5->saveHTML($fd->document);

HTML5-PHP puts the elements into the XHTML namespace. To use XPath expressions, you will need to register a prefix for it:
$html5 = new Masterminds\HTML5();
$fd = FluentDOM($html5->loadHTML($html));
  'xhtml', ''
echo $fd->find('//xhtml:p')->text();
SitePoint PHPAPIfy Your Legacy App with Toro (16.8.2014, 18:00 UTC)

For the Google Summer of Code 2014, I was selected for a project to create a REST API for ATutor. ATutor has hundreds of thousands of lines of code, yet is written in core PHP. Introducing a PHP router class for the API was necessary, but we needed something unintrusive. In this post, we discuss the essential parts of the project. For this post, all code examples would correspond to my fork of ATutor’s repository (links to files will be provided whenever necessary).

Note - Google Summer of Code is a program where students all around the world can participate in open source projects of mentoring organizations. Google organizes the program and pays the stipends, but the students are not employed by Google at any point during the program.

Web Routing with Toro

The first step in the process was to create or write a PHP class to perform the routing. After considering a few options, we decided to go with Toro, a the light weight PHP router. It performs just the routing - nothing more, nothing less. The syntax is pretty intuitive and you will get started in minutes.

Toro is RESTful- it has support for the standard HTTP methods- GET, POST, PUT and DELETE. There is support for JSON based requests too. All of this is packed in a 120 odd line file.

Before we proceed, one more step was to configure the server to redirect all requests to the router. This can be performed by adding an .htaccess file in Apache, or changing the configuration file of Nginx. This step of server configuration is explained on the README of Toro’s GitHub repository.

Continue reading %APIfy Your Legacy App with Toro%

Paul M. JonesDRY is about Knowledge (16.8.2014, 15:34 UTC)

From Matthias Verraes:

“Don’t Repeat Yourself” was never about code. It’s about knowledge. It’s about cohesion. If two pieces of code represent the exact same knowledge, they will always change together. Having to change them both is risky: you might forget one of them. On the other hand, if two identical pieces of code represent different knowledge, they will change independently. De-duplicating them introduces risk, because changing the knowledge for one object, might accidentally change it for the other object.

This is a great observation, one I had not considered before. It makes me feel a lot better about the very few and very minor duplications of code in the various independent and decoupled libraries in Aura. In short, DRY is not a reason to couple code libraries with similar behaviors; instead, it is a reason to have a single canonical source of knowledge within a system.

SitePoint PHP9 reasons to consider eZ Publish CMS for your next web project (15.8.2014, 16:00 UTC)


With the recent refactoring of eZ Publish content management system as a full stack Symfony application it should be interesting for a broader PHP public to consider it as a content management solution. We at Netgen have been using it for almost a decade and would like to share our reasons why it is a good choice in certain cases.

Before going deeper into the reasons why someone should consider eZ as a CMS solution, lets note a few disclaimers and audience filters:

  • if the development team is really small or the project is just a simple web site then there is no good incentive to consider eZ. There are lots of other solutions that are easier to learn.

  • if your web project doesn’t need content management or that part of the project is very simple, there is no good incentive to consider eZ either.

This post is about reasons why you should consider eZ, it’s not about praising it is an ultimate solution. It has its share of problems, like the following ones:

  • Currently eZ is shipped as dual stack (version 5.* with new and legacy code) and this could be an obstacle to less experienced teams. Recently I discussed on our blog about the hybrid approach we are currently taking and in short: it’s not simple. But its a temporary situation which causes some bad side effects like confusing dual documentation, etc. Installation could also be troublesome like Sitepoint’s editor Bruno discovered recently. But by the end of the year eZ should release a developer preview version with the new stack only. Next year the first stable version could hit the streets (named : eZ Publish 6 or eZ Platform).

  • Historically, it always had a steep learning curve. This might be the number one reason why eZ didn’t get more traction over the years. With the new stack implemented as a Symfony application this could change. Putting aside the transition situation, where some features are not yet implemented on the new stack (hence falling back to legacy), the new stack should be easier to learn as the development practices are more common (especially to Symfony developers) and less specific only to eZ.

  • The Community is not very big. Some prefer 10000 active developers behind a product, but this is not the case here. Actually, the community is quite active for its size and it consists of people from companies and larger teams that use eZ. And given the fact that Symfony is now the underlying PHP framework, the community could get larger very soon.

If you are not completely repelled by the problems, lets focus on the good side: reasons why I think PHP developers should consider eZ Publish’s new stack for their next content oriented web project.

Continue reading %9 reasons to consider eZ Publish CMS for your next web project%

PHP: Hypertext PreprocessorPHP 5.6.0RC4 is available (15.8.2014, 00:00 UTC)
The PHP development team announces the immediate availability of the fourth and hopefully last release candidate of PHP 5.6.0. As we entered the feature freeze with beta1, this is a bugfix-only release. All users of PHP are encouraged to test this version carefully, and report any bugs in the bug tracking system. THIS IS A DEVELOPMENT PREVIEW - DO NOT USE IT IN PRODUCTION! For more information about the new features you can check out the work-in-progress documentation or you can read the full list of changes in the NEWS file contained in the release archive. For source downloads of PHP 5.6.0RC4 please visit the download page. Windows binaries can be found on The stable 5.6.0 release should show up on the 28th of August. Thank you for helping us make PHP better.
Brandon SavageBack On The Market! (14.8.2014, 18:38 UTC)
With a couple projects wrapping up, I will once again have some free time to take on additional work in the form of contract or long-term projects. With more than ten years of experience in PHP development, I’ve worked on both large and small code bases alike. I am available to provide help modernizing a […]
labs @ Qandidate.comAsynchronous Phystrix explained (14.8.2014, 15:00 UTC)

We started this blog series with the basics of a circuit breaker. Our second post showed a running demo of an API consisting of two private microservices using oDesk’s Phystrix. The demo consisted of asynchronous calls using ReactPHP.

The demo itself shows a working circuit breaker, but I didn’t explain how Phystrix actually works. This blog will go through the demo code and show the changes we had to make to get Phystrix running asynchronously, while also looking more in-depth as to how Phystrix actually works. Awesome!

∞ labs @ Permalink

Johannes SchlüterPHP 5.3 - Thanks for all the Fish (14.8.2014, 13:42 UTC)

A few moments ago I pushed the buttons and PHP 5.3.29 came out. As this is the final release for 5.3 it is a good time to look back. PHP 5.3's history starts somewhere in 2005. We knew what a pressure point of PHP was - a language made for solving The Web Problem needs a good Unicode story. So some developers went deep into that complex area and created a prototype version of PHP with Unicode support from deep within the engine. As this was a big and pressing issue and the need was obvious and the solution looked promising it was quickly areed on making that the base for a future PHP 6. And then time passed, initial enthusiasm passed and the sheer amount of work became obvious. Two years in we noticed that the ongoing PHP 6 work blocked other work - new features couldn't be added to 5.2, the current version at that time, and adding them to (at that time) CVS's HEAD.

For solving the blocking issue we decided to create an intermediate release, pacing in all the things piled up, so on 2007-09-26 we branched off a CVS branch PHP_5_3.

Branching of PHP 5.3 set lots of enthusiasm free, and people started creating features and going into heated debates about the direction we should take so I was happy when Lukas volunteered to assist in the release management as Co-RM, playing a big role in making PHP 5.3, one of the most feature rich PHP releases, a huge success which was declared stable two years after branching of on June 30th 2009!

In those two years of development, from branching of till releasing 5.3.0 stable, we saw 5,338 commits by 83 committers (also committing work by other contributors without direct commit access) seeing 10,125 files being changed, with 1,089,600 insertions and 270,921 deletions (including tests and and generated files like parsers etc.) PHP 5.3 introduced many things many PHP developers see as normal and can hardly remember not using - things like namespaces or anonymous functions. It also introduced goto, late static binding, nowdoc, ?:, exception linking fileinfo, intl, mysqlnd, ... while also being a massive boost in performance. A massive release.

While trying to release 5.3.0 we noticed issues in our process. Notable things were that we, for a long time, didn't have a fixed cut of date and couldn't offer a promise when the next release will come. As a consequence people tried hard to push features in, as they feared having to wait a few years for the net release. In consequence a stricter release process with yearly releases etc. was created. Which lead to PHP 5.4 and 5.5 being almost on time and the upcoming PHP 5.6 being well on track.

Now development of 5.3 didn't stop with 5.3.0 but saw 29 bugfix releases with 7,554 commits from 152 comitters (due to the move to git in between a single committer might be counted multiple times, on the other hand more "external" contributor's names are being kept) and seeing 4,862 files being changed, 376,187 insertions and 207314 deletions.

On the personal side being the release master of PHP 5.3 gave me the opportunity to travel between Moscow and California and teaching different audiences in multiple languages about the great work, which was done mostly by others. (Check the ChangeLog to see whom to thank for your favorite feature!)

But now it's time to close that chapter - as of now PHP 5.3 is not supported anymore and the different RM teams and contributors are making PHP even better than PHP 5.3 ever was, as we can see in existing and previews of future releases.

Thank You All, it was a great time!

LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP