How did switching to PHP 7.0 boost development by 50%?

XSolve
XSolve Blog

--

Developing an old application using outdated technology (e.g. PHP 5.0) can be quite problematic. Introducing new people to a project of this kind is really taxing and time-consuming, especially if they are not very experienced. It might seem that the whole process must be complicated and laborious, and yet — it doesn’t have to be like this.

We encountered that problem several times in one of our past projects, not so easy to implement. We wondered how to simplify the environment configuration for new developers.

Below, you can read what kind of simple changes we introduced to the project to facilitate the onboarding of new programmers and accelerate the development process.

Switching from Vagrant to Docker

The isolation of the development environment is very important as it lets you recreate the production environment on the developers’ computers. Full virtualization can be a good solution if you want to ensure total isolation: it allows you to simulate the environment along with the operating system. Unfortunately, it causes big performance overhead. In the project described here, we used Vagrant and VirtualBox together with Ubuntu image configured by Puppet to provide consistency between the developers’ computers.

When it comes to performance — use containers!

The problem arose when the configuration started to change — we wanted to be able to switch quickly between various versions of services and components such as databases, interpreters, or queue systems. Preparing and switching between several VMs would be too troublesome so we decided to use Docker, now often employed in software development. The configuration was limited to separating particular services to individual containers by means of Docker Compose. Thanks to that, we could keep the configuration process for the new programmers to a minimum — starting the environment was just about calling the following command:

</>
docker-compose up -d --build

Switching from PHP 5.5 to PHP 7.0

Support for PHP 5.5 ended on 21 July 2016, so we had to prepare the app for the latest version of the interpreter as soon as possible. The code just needed some cosmetic changes. With the help of Docker Compose, we were able to swiftly compare how the app functioned on various PHP versions and return to the old version if any problem occurred. Thanks to the good code coverage, we could verify its functioning.

Switching to PHP 7 enabled us to shorten the time of PHPUnit tests, and that consequently shortened the time of task execution. The results are presented below.

Screen 1: Testing time on Travis CI
Screen 2: Comparison between time testing

Switching from Jenkins to Travis CI

The Continuous Integration system that we had used so far was Jenkins, which allowed us to launch tests on one of our servers. However, it was rather hard to configure and the installation of various components’ versions for a specific test was not possible. That proved particularly difficult in switching PHP versions and could change other applications on the server, so the test could not be realized.

These restrictions are not present in Travis CI, though. It is based on containers, which makes it possible to configure the test environment at starting each test suite in accordance with the configuration file attached to every project repository.

Conclusion

In this article, we wished to show you how simple changes help quicken developers’ work and facilitate introducing new people into a project. If you’re working on an old project using outdated — and sometimes unsupported — technologies, consider refreshing your application.

It turns out that it is not as painstaking as it might look in the beginning, and the benefits are really great.

Originally published at xsolve.software on February 28, 2017.

--

--

XSolve
XSolve Blog

Agile Software House focused on PHP/Symfony, Java, JavaScript and Mobile.