The Guide for Time Series Data Projects is out.

Download now
Skip to content
Blog

PHP 7 Support

This article is more than 4 years old

We are excited to announce that crate-pdo and its ORM Layer crate-dbal now support PHP 7.

The current version of the Crate PDO library is fully compatible with PHP 7. No adaptions, fixes or version upgrades were necessary, awesome! However, a lot has changed since PHP 5 that you might be interested in knowing about.

In this new PHP version the language offers new and exciting language features, such as anonymous classes, generator delegation and return type declarations. The most significant changes lie under-the-hood and both performance and inconsistency fixes have been major focuses for this release. Users can especially feel these changes on instances with smaller hosts.

Let's see how the new PHP version performs on Crate-PDO unit tests. We'll compare version 5.6.3 with 7.0.2 of PHP and run tests on each.

PHP 5.6.3

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ./vendor/bin/phpunit --coverage-html ./report
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

Runtime:    PHP 5.6.3 with Xdebug 2.3.3
Configuration:    /vagrant/phpunit.xml.dist

...............................................................  63 / 128 ( 49%)
............................................................... 126 / 128 ( 98%)
..

Time: 17.05 seconds, Memory: 14.75Mb

OK (128 tests, 223 assertions)

Generating code coverage report in HTML format ... done

PHP 7.0.2

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ./vendor/bin/phpunit --coverage-html ./report
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

Runtime:    PHP 7.0.2 with Xdebug 2.4.0RC4-dev
Configuration:    /vagrant/phpunit.xml.dist

...............................................................  63 / 128 ( 49%)
............................................................... 126 / 128 ( 98%)
..

Time: 12.54 seconds, Memory: 10.00Mb

OK (128 tests, 223 assertions)

Generating code coverage report in HTML format ... done

The tests on PHP 7 run up to 30% faster. In addition to performance there are substantial memory savings, as optimization of internal data structures is one of the primary ways in which performance improvements have been achieved.

We are looking forward to hear from your experiences with the Crate PDO driver with PHP 7.