![]() Any other CI installation offering you plenty of PHP versions will also work as long as you are running your code on all the PHP versions you intend to support.įinal suggestion: Drop support for PHP 5.3 and 5.4. They do offer plans for private repositories as well. Basically you get it for free, and adding different PHP versions is like adding a new line in the travis.yml configuration file. ![]() I would recommend using Travis CI for open source projects. You can detect this error condition and either have a different solution, or inform the user he has to add something to his PHP installation. PHP has function_exists() and method_exists() to detect if you can call something before you do (and fail with a fatal error). This isn't a problem with the PHP version itself. This would allow to execute different parts of the code depending on the version, allowing to add compatibility layers for some things you need if you run on lower versions, and using the PHP implementation (usually faster) when running on more recent versions.Īpart from this, you will always stumble upon problems with extensions not being installed. PHP comes with a constant PHP_VERSION that contains the current version you are running on, and has a function version_compare() to allow for easy comparing of version notation as in "which one is greater". It helps to use a IDE that knows about these features and warns you if you use something that isn't supported in the version you selected. Disregarding PHP 5.3 with its several patch versions that added significant improves for a moment, this boils down to knowing what features were brought with PHP 5.4, 5.5, 5.6 and 7.0, and explicitly pointing to that version in your composer.json.Īs a hint: 5.4 has short array syntax and traits, 5.5 has generators and finally, 5.6 comes with variadic functions and argument unpacking, and 7.0 has scalar type hinting and return types. In general, you should be aware of which features became available in which version. If PHP is unable to parse the file, it will tell you. ![]() Install the PHP version you want to test and run php -l file.php to test if the file passes the lint check.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |