PHP Development Trends in 2016 - Infopulse
image of banner
Back

PHP Development Trends in 2016

If you recognise the lines of code below, then you are potentially in the know of PHP development over the recent years.

$client = new \Joli\ArDrone\Client();
// use API service (see below)
$client->start();

PHP-ar-drone is a node-ar-drone port allowing the user to control the Parrot AR Drone in PHP. A few years ago when Adrian Baptist demonstrated this technology it could sound like a joke :), but today it’s different.

Both famous and not very famous PHP developers are now discussing three main topics: PHP 7 vs HHVM, asynchronous programming in ReactPHP and PSR-7 and micro frameworks as middleware.

The discussion about the future of PHP revived with the arrival of the straightforward competitor of the PHP Zend Engine. HHVM came to be such a competitor. It is a virtual machine for compiling PHP code into a machine one. It is based on JIT developed by Facebook for solving problems with ever-growing server loads. With the performance improvement, the traffic grew 500-600 times compared to the popular PHP versions based on Zend 2. After that, HHVM was opened for free use, primarily for WordPress. That was the reason why founders of Zend Engine started considering HHVM as their primary competitor and released the third version for PHP 7 by December 2015.

I recommend you to read the review of the test of different versions of PHP compared with HHVM here.

Although there was not even the slightest hint of competition, the PHP community considerably revived and completed many things that had been on the list for many years. Today, it can be seen in 100% increase in performance of PHP 7 compared to all previous fifth versions. Also, there was some strengthening of interest in asynchronous capabilities of PHP and the use of React technologies as well as in the PSR 7 integration into some popular frameworks.

Below, I want to cite some of the most famous PHP gurus in Reddit and Quora to somehow sum up my reflections about the trends and forecasts.

Adam Englander, the Engineering Director at LaunchKey, Inc., said:

“2016 will witness more and more frameworks compatibility. Symfony, Laravel and Drupal (CMS) are just a beginning. PSR-7 will also promote wider a wider use of frameworks based on the middleware concept. Slim Framework v.3 and Zend Expressive are both proper middleware frameworks. It is a new era in PHP with the interaction principle in its core.

We should also see the growth in the asynchronous programming, among other things owing to icicle.io. The team developing icicle.io went a long way to make asynchronous programming more accessible with the use of Promises and Generators, which is in many ways similar to ECMAScript 2015 in JavaScript.

My last forecast for 2016, will be grounded on the previous prediction. You will see some movement on the real hardware level, the development of Internet things (IoT) in PHP. With truly asynchronously programmable frameworks benefiting from asynchronous input/ output, you will be able to develop PHP applications that will be easily read the inputs on Raspberry Pi, Intel Edison and other IoT devices operating on Linux-based systems.”

Raphael Dohms, the creator of Amsterdam PHD, also said:

“I think that it will be an interesting year for PHP. Along with the launch of PHP 7, giving the performance a boost that we have seen in HHVM over recent years, which by itself gave a new life to the existing platforms as well as helped many companies to save on the infrastructure, the factor that will influence the further development is PSR -7.

PSR -7, the HTTP communication standard, gave birth to the possibility to create solutions in the most variable forms. Primarily, it has brought strong attention to and showed the ease of the Middleware pattern use. Now this allows PHP to fallow the trends that can be seen in the Node.js community creating systems that use middleware.

Zend Expressive is a wonderful example of a very small realization of this model that, in its turn, allows us to move from monolith structures (it took us 4-5 years) and to really start “compiling” a solution of many small and mixed blocks.

It is a new life for micro frameworks and micro libraries, the tendencies that we have already seen. For me, at least, the future trend is based on these more component frameworks and solutions, created by gluing together the parts of several frameworks that overlap with the thin HTTP realization largely based on PSR-7 and middleware.”

My personal opinion about this year’s trends slightly differs from the above as the trend establishes itself only when the technology, PHP 7, ReactPHP or even HHVM, “goes public”: becomes absorbed by the main user. And we know that statistically the main user is the majority, that is small projects on WordPress, Drupal and Magento where traffic and server loads rarely exceed the limits.

On the other hand, mastering and managing a complex configuration of, for example, HHVM is a task for few developers of WordPress. For example, making your hosting provider install PHP 7 on their server or shared hosting is a dubious task for any average developer. It’s obvious that larger projects formed by the minority use their financial capacities rather efficiently to solve the traffic problems by buying and equipping their servers according to their needs. And of course the largest companies with their sufficient expert base wisely use their financial leverage to optimize technologies rather than servers.

That is why, this year’s trend, as I humbly believe, can become a technology which is attracting less public attention these days: Phalcon + Zephir. This is the technology that gives a spike in speed and, with its simplicity, can appeal to any modern frameworker.

Watch a small video about creating an application in Phalcon in 15 minutes:

As you can see, to install Phalcon on Ubuntu is as complex as follows:

$ sudo apt-add-repository ppa:phalcon/stable
$ sudo apt-get update
$ sudo apt-get install php5-phalcon

Intalling Zephir:

$ git clone https://github.com/phalcon/zephir
$ cd zephir
$ ./install -c

Beforehand, install a compiler, a few packages for PHP:

$ sudo apt-get update
$ sudo apt-get install git gcc make re2c php5 php5-json php5-dev libpcre3-dev

And now you are ready to make not only a survey in 15 minutes but also a small calculator to count the votes of your survey:

namespace Myframework;
class Calculator {
public function add(int a, int b) {
return a + b;
}
}

For a PHP developer, all is rather familiar – just remember to specify the type of data for compilation (you can either declare or indicate them statically by entering int, bool, char).

Tell Zephir bin/zephir compile to compile an extension in C, and then return it into the PHP environment with the use of a few commands:

$ cd ext/
$ phpize
$ ./configure
$ make
$ sudo make install
$ echo "extension=/usr/lib/php5/20100525/myframework.so" | sudo tee -a /etc/php5/cli/conf.d/myframework.ini

Now we have a C extension for Phalcon! Testing:

$ php -a
Interactive mode enabled
php > $calc = new Myframework\Calculator;
php > var_dump($calc->add(2, 1));
int(3)

Those who got interested in this magic can find more instructions here.

The innovation in Phalcon is not that a framework becomes a C extension for your machine, but that Zephir empowers any PHP developer to extend the functionality of a framework in its original language.

So, it gently brings us back to the trend concept described at the beginning of this article, when a PHP developer gets a ticket into the IoT world and enters, comfortably seated on his elephant.

It’s exciting; therefore, it has all prerequisites to become a trend!

Good luck with all of your PHP development endeavours and feel free to ask us if you need any assistance.

Next Article

We have a solution to your needs. Just send us a message, and our experts will follow up with you asap.

Thank you!

We have received your request and will contact you back soon.