Help us shape the future of Go! Take the 2026 Go Developer Survey

igor-php

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 13 Imported by: 0

README ΒΆ

πŸ§Ÿβ€β™‚οΈβš‘ Igor-Php

Igor PHP Logo

The faithful assistant for your FrankenPHP Workers.

igor-php is an ultra-fast static linter written in Go that prepares your Symfony application for the persistent memory model of FrankenPHP.

Like the legendary assistant, igor checks every connection and part of your application to ensure it won't "blow up" when the lightning strikes (Worker Mode).


✨ Highlights

  • ⚑ Lightning Fast: Scans hundreds of files in milliseconds using Go's native multi-threading.
  • πŸ” Deep Audit: Automatically detects Symfony projects and audits every shared service defined in the container, including those in vendor/ and external bundles.
  • 🎯 Surgical Precision: Detects complex state mutations ($this->prop[], static::$prop, increments) without false positives.
  • 🧠 Intelligent: Verifies not just the presence of ResetInterface, but ensures all mutated properties are correctly reset.
  • πŸ›‘οΈ Safety First: Catches dangerous exit() or die() calls that would kill your workers.
  • πŸ”‡ Zero Noise: Automatically ignores Symfony\ and Doctrine\ namespaces, and common data folders (Entity, Dto, ApiResource).

πŸ“‹ Prerequisites

  • Go: Required to compile or install the binary.
  • PHP 8.1+: Required for the Deep Audit mode. Igor uses PHP Reflection to precisely locate service files within your project and vendor/ directory. Without PHP, Igor will fall back to a standard directory scan.

πŸš€ Installation

composer require --dev igor-php/igor-php
Via Go
go install github.com/igor-php/igor-php@latest

πŸ› οΈ Usage

Install the binary and let Igor audit your Symfony project (ensure bin/console is present for Deep Audit):

# If installed via Composer
./vendor/bin/igor-php .

# If installed via Go
igor-php .
Deep Audit Mode (Symfony)

When a Symfony project is detected, Igor will:

  1. Query the container in PROD mode (--env=prod --no-debug).
  2. Map every shared service to its actual source file via PHP Reflection.
  3. Perform an exhaustive audit of your code and all its dependencies.
Example Output
πŸ“‚ src/Service/MyService.php
  ❌ Mutation of state 'cache' in MyService::getData().
  42 | $this->cache = $result;

⚠️  Property 'tempData' of MyService is mutated but not reset in reset().
  πŸ’‘ Hint: Add '$this->tempData = null;' in the reset() method.

βš™οΈ Configuration

You can customize Igor's behavior by creating an igor.json file at the root of your project:

{
  "exclude": ["vendor", "tests", "Entity"],
  "safe_namespaces": ["Symfony\\", "Doctrine\\", "My\\Safe\\Namespace\\"]
}
  • exclude: List of directories to skip during indexing.
  • safe_namespaces: Igor will ignore state mutations in classes starting with these prefixes.

πŸ€– CI/CD Integration

Igor is designed to work out-of-the-box in your CI pipelines. It will exit with code 1 if any error is found, effectively stopping your build.

GitHub Actions Example
name: Static Analysis
on: [push, pull_request]

jobs:
  igor:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.2'

      - name: Install Dependencies
        run: composer install --no-progress --prefer-dist

      - name: Setup Go
        uses: actions/setup-go@v5
        with:
          go-version: '1.23'

      - name: Run Igor
        run: |
          go install github.com/igor-php/igor-php@latest
          igor-php .

πŸ™ Credits & Inspirations

  • Phanalist: Special thanks to phanalist and its rule E0012 (Stateful Service) which inspired Igor's core mutation detection logic.
  • Gemini CLI: This project was built with the help of Gemini CLI.
  • FrankenPHP: For the amazing server that makes these checks necessary!

πŸ“„ License

MIT

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL