My friends and family are under attack in Ukraine.
Donate to protect them directly or help international organizations.
Donate to protect them directly or help international organizations.
Detect Compatibility Issues With phpco
PHPCompatibility detects compatibility issues between your code and a specific version of PHP, making it very useful for PHP upgrades.
If you already have Docker installed on your machine, you can run this tool more easily with phpco. You merely need to execute two console commands from your project's root:
phpco() { docker run --init -v $PWD:/mnt/src:cached --rm -u "$(id -u):$(id -g)" frbit/phpco:latest $@; return $?; }
phpco -p --colors --extensions=php,phtml --runtime-set testVersion 7.4 . --ignore="vendor/"
Customize the options to your liking.
--extensions
Include all extensions of files that can contain PHP code. Here, I addedphtml
because Zend Framework 1 applications can contain a lot of PHP code in their phtml views.testVersion
Set to the version to which you are upgrading.--ignore
Add any folders that you don't want to scan. Should all libraries be excluded? It depends. This explanation can help you with the decision.
The phpco repository has more complete documentation.