Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phplint Laravel Package

overtrue/phplint

PHPLint is a fast PHP syntax linter that runs multiple lint processes in parallel to speed up checking large codebases. Supports modern PHP versions, with easy installation via Composer, PHAR, Docker, or Phive, and configurable rules and paths.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install via Composer: composer require --dev overtrue/phplint.
  2. Run on your project: ./vendor/bin/phplint src/ or ./vendor/bin/phplint to lint all PHP files in the current directory (and subdirectories).
  3. First use case: Add it to your local workflow—run it before committing, or integrate into your IDE as a pre-save check.
  4. Check the CLI help with ./vendor/bin/phplint --help to see options like --parallel or --no-progress.

Implementation Patterns

  • Pre-commit hook: Use a tool like Husky (via Node) or (pre-commit) (Python) to run phplint on staged files. Example .pre-commit-config.yaml entry:
    - repo: local
      hooks:
        - id: phplint
          name: PHP Syntax Check
          entry: vendor/bin/phplint
          language: system
          types: [php]
    
  • CI/CD pipelines: Embed in GitHub Actions:
    - name: Lint PHP files
      run: vendor/bin/phplint --parallel
    
  • Build scripts: Add phplint as a step in composer scripts:
    "scripts": {
      "lint": "phplint src tests",
      "lint:ci": "phplint --parallel --no-progress src tests"
    }
    
  • Parallelization: Use --parallel (defaults to auto-detect cores) for faster checks on large monorepos—especially beneficial in CI where CPU cores are available.

Gotchas and Tips

  • Exit codes: phplint returns 0 on success and 1 on any parse error or warnings—crucial for CI failure detection. Don’t ignore this in scripts.
  • File filtering: By default, it lints .php files only. Use --extensions to override (e.g., --extensions=php,php4) if needed.
  • Quiet mode pitfall: Avoid --quiet in CI unless you capture raw output—errors won’t appear in logs otherwise. Prefer --no-progress instead for cleaner CI logs.
  • Parallel caveats: On macOS (especially with Homebrew PHP), pcntl_fork() may be disabled by default. Ensure pcntl is enabled if you see The process has been signaled with signal "11"—or explicitly disable parallel mode via --parallel=1.
  • Custom paths: If your repo contains vendor or cache dirs, exclude them with --exclude (e.g., --exclude=vendor,bootstrap/cache) to avoid false positives and speed up runs.
  • Integrate with static analysis: Use phplint before tools like PHPStan or PHPCS—catching syntax errors early avoids cascading false positives downstream.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport