nikic/php-parser

A PHP parser written in PHP

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 11 minutes ago
Added to GitGenius on September 3rd, 2026
Created on April 18th, 2011
Open Issues & Pull Requests: 70 (+0)
GitHub issues: Enabled
Number of forks: 1,134
Total Stargazers: 17,465 (+0)
Total Subscribers: 215 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 6.2 hours
Mean response time: 19.4 days
90th percentile: 49.4 days
Tracked items: 74

Most active contributors

Sign in to see contributor activity.

How this project is maintained

Around half of the issues opened in the past year never receive a reply. 100% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. Only 13% of issues opened in the past year have been closed. Three people close 65% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 20
New in 7 days: 0
Closed in 7 days: 1
Avg open age: 573 days
Stale 30+ days: 19
Stale 90+ days: 17

Recent activity

Opened in 7 days: 0
Closed in 7 days: 1
Comments in 7 days: 1
Events in 7 days: 3

Top labels

No label distribution available yet.

Most active issues this week

Detailed Description

PHP Parser is a static code analysis library that parses PHP code into an abstract syntax tree.

The tool addresses the need to programmatically analyze and manipulate PHP source code. It works by parsing PHP 7, PHP 8, and limited PHP 5.x syntax into an AST, then providing infrastructure to traverse, modify, and convert that tree back to PHP code. The parser can handle invalid or incomplete code, producing partial ASTs with accurate location information. Key capabilities include name resolution for namespaced identifiers, evaluation of constant expressions, AST builders for code generation, and formatting-preserving transformations that maintain whitespace and comments when modifying code.

Developers should choose this tool for static analysis tasks, code generation, refactoring, and linting applications where understanding PHP code structure is essential. It suits projects that need to inspect or transform PHP source without executing it. The library supports multiple PHP versions simultaneously—version 5.x runs on PHP 7.4 and later while parsing PHP 7.0 through 8.4, and version 4.x runs on PHP 7.0 and later while parsing PHP 5.2 through 8.3. The documentation covers walking and modifying ASTs, name resolution, pretty-printing with format preservation, error handling with recovery for malformed code, and performance optimization strategies.

The project maintains a substantial base of real-world adopters, as evidenced by the fact that nearly all open issues originate from external users rather than the core team. Maintainers typically respond to new issues and pull requests within a day.