talira

Lint PHP files faster by running several lint processes at once

open sourceMITfree

PHPLint is a command-line tool that checks PHP files for syntax errors faster than running php -l on each file, by running several lint processes in parallel. It runs from the console, in Docker or in CI, and can be used programmatically, with a YAML configuration file for paths, exclusions and options. Install it as a PHAR from its GitHub releases (the recommended way), with Phive, with Composer (overtrue/phplint) or from the overtrue/phplint Docker image. Version 9 is a full rewrite for PHP 8.x; Laurent Laville has maintained it since 9.0.

Problems it solves

  • php -l on every file in CI takes too long on a big PHP codebase
  • catch PHP syntax errors before deploy in a GitHub Actions pipeline
  • lint PHP files in parallel from a Docker image

Features

  • parallel PHP syntax linting
  • YAML configuration
  • PHAR, Phive, Composer and Docker installs
  • CI and programmatic use

Limitations

  • Needs PHP 8.2 or newer for the supported 9.7 and 9.8 versions; older PHP needs an end-of-life release.1

Alternatives

The same job

These do what PHPLint does.

  1. PHP Parallel Lint Checks the syntax of PHP files in parallel
  2. Super-Linter Ready-to-run collection of linters and formatters as a GitHub Action or container
  3. Easy Coding Standard (ECS) Runs PHP_CodeSniffer and PHP-CS-Fixer rules together, fast
  4. Hadolint Dockerfile linter that checks best practices and the shell in RUN lines
  5. PHP_CodeSniffer Detect and fix coding standard violations in PHP
  6. PHPCompatibility PHP_CodeSniffer sniffs that check PHP code for cross-version compatibility

Compare PHPLint with the top 3