📜 ⬆️ ⬇️

What are PHP trends saying in 2016?

If you learned these few lines of code below, then you are potentially in the trend of the last years of PHP development.

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



')
PHP-ar-drone is a node-ar-drone port that allows the user to manage Parrot AR Drone in PHP. A couple of years ago, when Adrien Baptist demonstrated this technology, it might have seemed like a couple :), but not today.

Famous personalities in the PHP world and not very well-known, many are now discussing three main topics on the Internet: PHP 7 vs. HHVM, asynchronous programming with ReactPHP and PSR-7, and microframes as middleware.

In many ways, the debate about the future of PHP has intensified with the advent of the “direct competitor” PHP engine Zend Engine. Such a competitor was HHVM - a virtual machine for compiling PHP code into machine, based on JIT, which was developed by Facebook to address the ever-increasing server load. Having achieved an increase in productivity, it was possible to increase traffic by 500-600 percent compared to popular PHP versions on Zend 2. After that, HHVM was given free to the WordPress community in the first place. That is what made the founders of Zend Engine perceive HHVM as a direct competitor and roll out the 3rd version of the engine for PHP 7 by December 2015.

I advise you to read a review of the results of testing PHP in different versions in comparison with HHVM here .

Although in fact the competition in the literal sense did not smell here, the PHP community has noticeably quickened and in a short time a lot has been done from what has been planned for many years. Today, this manifests itself in a 100% increase in the performance of PHP 7 compared to all 5 versions. Also noticeably increased interest in the asynchronous capabilities of PHP and the use of React technology along with the integration of PSR 7 in popular frameworks.

I chose some of the most comprehensive quotes from well-known PHP gurus on Reddit and Quora to somehow summarize the reflections on trends and forecasts, and I’ll give them below.

Adam Englander, engineering director of LaunchKey, Inc. put it this way:

“In 2016, we will see more and more compatibility between frameworks. Symfony, Laravel and Drupal (CMS) are just the beginning. Thanks to PSR-7, frameworks based on the concept of middleware will also become more common. The 3rd version of the Slim Framework and Zend Expressive are both real middleware frameworks. This is a new era in PHP with the principle of interaction at its very core.

We should also see an increase in asynchronous programming, in particular, thanks to icicle.io. The icicle.io development team has come a long way to make asynchronous programming more accessible using Promises and Generators, much like ECMAScript 2015 in JavaScript.

My latest forecast for 2016 will be based on a previous prediction. You will begin to see some movement at the level of real hardware, the development of the Internet of Things (IoT) in PHP. With truly asynchronous programmable frameworks that take advantage of asynchronous input / output, you can write PHP applications that can easily be put into Raspberry Pi, Intel Edison, and other IoT devices running Linux operating systems. ”

Rafael Dohms, creator of Amsterdam PHD, also said:

“I think it will be an interesting year for PHP. In addition to launching PHP 7, which gives a performance leap that we have seen at HHVM in recent years, which in itself has breathed new life into existing platforms, as well as helped many companies save on infrastructure, a factor that will affect further development is PSR - 7

PSR-7, the standard for HTTP messages, brought with it the ability to create solutions in a variety of forms. First of all, he paid a lot of attention and showed the ease of use of the Middleware pattern. This already allows PHP to follow trends, such as we see in the Node.js community in building systems that use middleware.

Zend Expressive is an excellent example of a very small implementation of this model, which in turn allows us to move away from monolithic structures (we have been doing this for 4-5 years) and really begin to “draw up” solutions from many small and mixed blocks.

This is a new breath for micro-frameworks and micro-libraries, trends that we have already seen. At least, for me, the future trend is based on these, more component frameworks, and solutions created from gluing the parts of several frameworks together, all overlapping over the thin HTTP implementation, largely based on PSR-7 and middleware. ”

My personal opinion on trends this year is a little different from all the above, as the trend becomes so, only when the technology, the 7th version of PHP, ReactPHP or even HHVM, “gets to the masses”, that is, absorbed by the main user. But we know that according to statistics, the main user is the majority, that is, small projects on WordPress, Drupal, Magento, the traffic of which and the load on the servers rarely exceed the permissible norms.

On the other hand, not every WordPress developer will be able to master and cope with complex configuration, for example, HHVM. Or, for example, forcing your hosting provider to install 7-ku on your server or shared hosting is a dubious task for any medium-sized developer. It goes without saying that larger projects that form the minority, it is quite practical to use financial capabilities in solving problems with traffic, purchasing and equipping a server according to their needs. And of course, only the largest companies usually having a sufficient expert base intelligently use financial leverage to optimize technology and not the server.

Therefore, the trend this year, in my humble opinion, may be the technology that is paying less attention today, namely Phalcon + Zephir. This is exactly the technology that gives a big leap in speed, and in ease of use it looks more attractive than any modern framework.

Watch a short video on how to create apps in 15 minutes with Phalcon:



As you can see, for Ubuntu users, installing Phalcon is just as complex:

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


Zephir installation:

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


Pre-install the compiler for several packages for PHP:

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


And now we are not just ready to create a questionnaire application in 15 minutes, but also, for the sake of simplicity of an example, write our calculator for counting votes in the application:

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

For a PHP developer, everything is pretty homely, just the main thing to remember is to specify the data types for compiling (you can use a declaration or statically prescribe an int, bool, char).

We tell the zephyr bin / zephir compile to compile the expansion for us in C, and then return it to the PHP environment using a few simple 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 


We have an extension for Phalcon! Testing:

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


If you are already interested in this magic, you can delve into the documentation here .

Innovatively in Phalcon, it’s not even that the framework becomes an extension for your machine, but that Zephir gives any PHP developer the super power to extend the framework functionality in their native language.
And this unobtrusively brings us back to the concept of the trend described at the beginning of this article, when the PHP developer gets a ticket to the world of IoT, and comfortably enters it on his elephant.

It captures, and what captures, has all the prerequisites to become a trend!

Source: https://habr.com/ru/post/279461/


All Articles