# nikic/PHP-Parser

A PHP parser written in PHP

Repository: https://github.com/nikic/PHP-Parser
Canonical: https://ross.abutalabs.com/products/php-parser
Language: PHP
License: BSD-3-Clause
License Family: permissive
Topics: php, parser, ast, static-analysis
Last push: 2026-08-23T19:01:01+00:00

## Health v2 (maintenance only)
Score: 96/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 91, longevity 100
- inputs: {"age_days": 5616, "days_push": 10, "days_rel": 60, "gap_med": 17, "n_releases_24m": 14}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 17456, forks 1132 (observed 2026-08-28T04:11:19.849963+00:00)

## What it is
A PHP parser written in PHP that converts PHP 5.x through 8.4 code into an abstract syntax tree (AST). It provides AST traversal, modification, pretty-printing back to code, name resolution, and constant expression evaluation for static analysis and code manipulation.

## Use cases
- parse php code into an ast
- build a static analysis tool for php
- refactor php code programmatically
- generate php code from an ast
- detect deprecated php syntax in a codebase
- write a custom php linter
- transpile or transform php source code

## When to choose
- you need to parse, analyze, or transform PHP source code in a PHP project
- you want accurate location information and error-tolerant parsing of invalid code
- you need to preserve formatting when modifying code
- you are building linters, codemods, or code generators for PHP

## When to avoid
- you need to parse a language other than PHP
- you need a runtime interpreter or execution engine rather than a parser
- you need to parse PHP 4 or older code

## Facets
- artifact type: library
- maturity: stable
- function: parser, static-site-generator, developer-tools
- domain: parsers, programming-languages, developer-tools
- platform: php
- tags: ast, php-parser, static-analysis, code-generation, code-manipulation

## Member repositories
- nikic/PHP-Parser (main) score 96

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:19.849963+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:02:56.793530+00:00, confidence not recorded.
  - readme: https://github.com/nikic/PHP-Parser (fetched 2026-08-28T04:11:19.849963+00:00, sha 0ebdd809dbfb)
- Data as of 2026-08-30T08:39:29.467469+00:00.
