PHP Code Analysis

Comprehensive analysis of PHP applications, Laravel/Symfony services, and WordPress architectures

What Axiom Refract Analyzes in PHP

Namespace and Autoload Resolution

Resolves PHP namespace use statements and maps class autoloading paths via PSR-4 and PSR-0 configurations in composer.json. Handles classmap and files autoloading entries.

Laravel Service Container Analysis

Maps Laravel service provider registrations, facade bindings, and dependency injection patterns. Identifies coupling through the service container that is invisible in import analysis.

Trait Usage Mapping

Traces PHP trait usage across classes, including conflict resolution (insteadof, as), and identifies coupling between traits and the classes that compose them.

WordPress Hook System Analysis

Maps add_action/add_filter registrations and their corresponding do_action/apply_filters call sites. Traces the event-driven dependency graph in WordPress plugin and theme architectures.

How It Works

PHP is parsed using a hand-hardened Tree-sitter grammar supporting PHP 7.4 through 8.3 syntax, including named arguments, enums, fibers, readonly classes, and intersection types. The parser resolves Composer PSR-4 autoloading maps to convert namespace/class references into file paths. WordPress-specific patterns are detected by recognizing WP core function calls, hook registrations, and plugin/theme header annotations.

Common Findings in PHP Codebases

God Controller Pattern

PHP applications frequently develop controllers with hundreds of methods. Axiom identifies controllers with high method counts and suggests decomposition based on structural analysis.

Static Method Coupling

PHP codebases often rely heavily on static method calls, creating tight coupling that is difficult to test and refactor. Axiom maps static call dependencies and identifies classes with excessive static coupling.

Global Function Dependencies

PHP allows global function definitions that create implicit dependencies between files. Axiom detects global function calls and maps them to their defining files.

Polyglot Support

PHP is one of 145+ languages Axiom Refract supports through Tree-sitter AST parsing. PHP analysis covers composer.json, composer.lock, .php files, Blade templates, Twig templates, and PHP configuration files. Framework detection covers Laravel, Symfony, WordPress, Drupal, and CodeIgniter structures. Your entire codebase is analyzed in a single scan — regardless of how many languages it contains.

Analyze your PHP codebase.