The Right Way to Upgrade PHP to 7.1+

Laravel Framework has been upgraded to Laravel 5.6. It's quite important to follow the steps of official releases for the framework you are working on. I have seen several projects stuck on some old versions of  PHP and never can upgrade to the latest version again.

Upgrading PHP version for your project is high risk, especially for large projects. I really don't suggest you upgrading PHP for large projects, it's easy of losing control. As for your new projects or some small projects, you should absolutely use the latest version of PHP. The only thing I want you to keep in mind is to do what you can do to reduce the risk.

Improve Code Coverage

Code coverage is a status indicator, not a unit to measure performance or correctness. But, the point is that the higher coverage you got, the lower the risk of bugs you will have. If you have a 100% coverage report, that means each line of your code is exercised and the correctness percentage of your code is more close to 100%.

/path/to/phpunit --configuration phpunit.xml --coverage-html/path/to/the/coverage/report

Check PHP Compatibility

PHP Compatibility Checking is necessary and very helpful when you are going to upgrade your PHP version. The project is at If you are not using modern IDE with PHP Version Compatibility support, you will be very grateful for running the Compatibility Checking.

Here is an example of my PHPCS rules. The node name is human readable.

<?xml version="1.0"?>
<ruleset name="PHP Code Sniffer Rule Set">
    <description>Rules for PHP CodeSniffer</description>
    <rule ref="PHPCompatibility"/>
    <rule ref="PSR2">
        <exclude name="Generic.Files.LineLength"/>

    <config name="testVersion" value="7.1-"/>
    <ini name="memory_limit" value="128M"/>

    <arg name="colors"/>
    <arg value="p"/>



Questions or comments? Please leave it below.