AgentLint Verified 87/10064 PHP repos analyzed

    PHP CLAUDE.md & AGENTS.md Template

    Pest/PHPUnit filters, PHPStan strictness, and Composer scripts from 64 PHP repos.

    # PHP Project — PHP 8.4 Harness
    
    Modern PHP 8.4 / Laravel codebase verified with Pest, PHPStan level 8, and Pint.
    
    ## Commands
    
    - Fast single test: `vendor/bin/pest --filter=InvoiceTest`
    - Full suite: `composer test`
    - Static analysis & style: `vendor/bin/phpstan analyse && vendor/bin/pint --test`
    
    ## Rules
    
    - Don't create new PHP files without `declare(strict_types=1);` and explicit parameter/return types. Because weak coercion hides silent type bugs.
    - Don't interpolate variables into raw SQL queries. Instead use parameterized bindings or Eloquent builders. Because string interpolation creates SQL injection holes.
    - When editing database migrations, read `docs/schema-changes.md` first.
    
    ## Continuity
    
    - Keep `.env` and `CLAUDE.local.md` out of git and summarize schema impacts in `HANDOFF.md`.

    Most Adopted PHP Rules Across Real Open-Source Repos

    Measured across 64 public PHP repositories in the 4,533-repo harness study:

    composertooling

    Composer for package management

    53.1%34 repos
    phpunittesting

    PHPUnit for testing

    50.0%32 repos
    unit-teststesting

    Write unit tests for all changes

    40.6%26 repos
    laravelframework

    Laravel framework

    37.5%24 repos
    migrationspatterns

    Database migrations

    35.9%23 repos
    psrpatterns

    PSR coding standards

    29.7%19 repos
    dockertooling

    Docker for containerization

    29.7%19 repos
    ci-cdtooling

    CI/CD pipeline must pass

    29.7%19 repos
    Essential Commands (Checks W1 & W7)
    install
    composer install --no-interaction
    fastTest
    vendor/bin/pest --filter=TargetTest
    fullTest
    composer test
    lint
    vendor/bin/phpstan analyse && vendor/bin/pint --test
    build
    composer validate --strict
    Common PHP Agent Pitfalls
    • 01Agents skip declare(strict_types=1); or write untyped arrays instead of DTOs.
    • 02Direct SQL string interpolation bypasses query-builder parameterization.

    More Verified Stack Templates