Registry / utility / nikic-php-parser

nikic-php-parser

JSON →
library5.7.0phppackagistunverified

A PHP parser written in PHP

composer require nikic/php-parser
INSTALL
IMPORT
SIG · NIKIC-PHP-PARSER
N
nikic-php-parser
utilityphpv5.7.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ParserFactory
use PhpParser\ParserFactory;

Parse PHP code into an abstract syntax tree (AST).

use PhpParser\ParserFactory; $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); $stmts = $parser->parse('<?php echo "Hello";'); // $stmts is an array of statement nodes
Debug
Known issues
breakingVersion 5.x requires PHP 8.1 or later.
fix
Use version 4.x for PHP 7.4-8.0 compatibility.
affects: >=5.0.0
Upgrade
Version history
5.7.0latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
nikic-php-parser — pip install nikic-php-parser · libregistry