cline/analyzer

Configurable parallel PHP code analyzer for checking class references

Installs: 407

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/cline/analyzer

2.0.0 2025-11-06 06:25 UTC

This package is auto-updated.

Last update: 2025-11-06 06:34:37 UTC


README

Configurable parallel PHP code analyzer for checking class references with Laravel Prompts UI and AI agent orchestration.

Requirements

Requires PHP 8.4+ and Laravel 12+

Installation

composer require cline/analyzer

The service provider will be automatically registered via Laravel's package discovery.

Features

  • Laravel Artisan Command: php artisan analyzer:analyze for easy CLI usage
  • AI Agent Mode: Generate XML-structured prompts for parallel AI-powered fixes
  • Configurable Architecture: Replace core components via interfaces
  • Parallel Processing: Analyze files concurrently with configurable worker count
  • Laravel Prompts UI: Beautiful terminal reporting with summary statistics
  • Flexible Resolution: Custom path, file, and analysis resolvers
  • Based on graham-analyzer: Built on battle-tested analysis logic

Usage

Artisan Command

# Analyze default paths (app, tests) with auto-detected CPU cores
php artisan analyzer:analyze

# Analyze specific paths
php artisan analyzer:analyze src tests

# Auto-detect CPU cores for parallel processing
php artisan analyzer:analyze --workers=auto

# Specify exact worker count
php artisan analyzer:analyze --workers=8

# Ignore specific class patterns
php artisan analyzer:analyze --ignore="Illuminate\\*" --ignore="Symfony\\*"

# Exclude files/directories from scanning
php artisan analyzer:analyze --exclude=vendor --exclude=storage

# AI agent mode - outputs XML prompts for automated fixing
php artisan analyzer:analyze --agent

Programmatic Usage

use Cline\Analyzer\Analyzer;
use Cline\Analyzer\Config\AnalyzerConfig;

$config = AnalyzerConfig::make()
    ->paths(['app', 'tests'])
    ->workers(0)  // 0 = auto-detect CPU cores
    ->ignore(['Illuminate\\*'])
    ->exclude(['vendor', 'storage']);

$analyzer = new Analyzer($config);
$results = $analyzer->analyze();

AI Agent Mode

Generate structured prompts for spawning parallel AI agents to fix issues:

$config = AnalyzerConfig::make()
    ->paths(['app'])
    ->agentMode();

$analyzer = new Analyzer($config);
$analyzer->analyze();

This outputs XML-structured orchestration prompts grouped by namespace for efficient parallel processing.

Configuration

Publish the configuration file:

php artisan vendor:publish --tag=analyzer-config

This creates analyzer.php in your project root:

<?php

use Cline\Analyzer\Config\AnalyzerConfig;

return AnalyzerConfig::make()
    ->paths(['app', 'tests'])
    ->workers(0)  // 0 = auto-detect CPU cores, or specify (e.g., 4, 8)
    ->ignore(['Illuminate\\*', 'Symfony\\*'])
    ->exclude(['vendor', 'node_modules', 'storage']);

Custom Resolvers

Implement custom resolution logic:

use Cline\Analyzer\Contracts\PathResolverInterface;

class CustomPathResolver implements PathResolverInterface
{
    public function resolve(array $paths): array
    {
        // Custom path resolution logic
        return $resolvedPaths;
    }
}

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please use the GitHub security reporting form rather than the issue queue.

Credits

License

The MIT License. Please see License File for more information.