3.5h
Time Saved/Dev/Week
40%
Faster Releases
Click for next insight
Usage
name: 'Usage of phplint GitHub Action'
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint PHP files
uses: overtrue/phplint@main
with:
path: .
options: --exclude=vendor
PHP Lint
A tool that can speed up linting of php files by running several lint processes at once.
What is PHP Lint?
For those working on PHP projects, ensuring that our code is free of syntax errors is crucial. PHPLint is a robust tool designed to speed up the linting process by executing multiple lint processes simultaneously. This makes it an excellent choice for integrating into our CI/CD pipeline with GitHub Actions.
How to Set Up PHPLint for Different PHP Versions and Operating Systems in GitHub Actions
For projects that need to ensure compatibility across various PHP versions and operating systems, setting up a dynamic CI/CD pipeline is essential. This guide will help you configure GitHub Actions to use PHPLint for detecting specific PHP features dependent on your runtime environment.
jobs:
php-lint:
name: "PHPLint v9"
runs-on: "${{ matrix.operating-system }}"
strategy:
fail-fast: false
matrix:
operating-system:
- "ubuntu-20.04"
- "ubuntu-22.04"
php-version:
- "8.1"
- "8.2"
- "8.3"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: sebastianbergmann/phpunit
- name: Setup PHP runtime
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"
- name: Lint PHP files
run: |
curl -Ls https://github.com/overtrue/phplint/releases/latest/download/phplint.phar -o /usr/local/bin/phplint
chmod +x /usr/local/bin/phplint
/usr/local/bin/phplint --no-cache --no-progress -v