BLOG // May 5, 2021
Automatically lint PHP files against multiple PHP versions on GitHub
I've made a free to use PHP action for automatically linting your pull requests against a wide variety of PHP versions.
This is particularly useful in a few cases, all of which we have at Snapt:
- We are always preparing to move forward to a new PHP version. E.g. we are on PHP 7.4 now, but lint'ing against 8.0 as well.
- We often have projects which need backwards compatibility, some to PHP5.
- Testing your code against various live versions is useful for distributed packages, e.g. PHP7.3, 7.4, 8.0.
Using the GitHub Action
You can easily add it to your project by creating
.github/workflows/phplint.yml with the below in it:
name: PHP Linting on: push jobs: phplint: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v1 with: fetch-depth: 0 - name: PHP Lint 7.4 uses: dbfx/github-phplint/7.4@master - name: PHP Lint 8.0 uses: dbfx/github-phplint/8.0@master
Supported PHP versions
It supports the following PHP versions (by tag):
Feel free to create an issue on the GitHub page or a PR.
Subscribe to new articles
If you enjoy my content, consider subscribing. You will only receive new blog stories, no other email.