Download the PHP package nikic/php-parser without Composer

On this page you can find all versions of the php package nikic/php-parser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

Please rate this library. Is it a good library?
nikic/php-parser
Rate from 1 - 5
Rated 5.00 based on 1 reviews

All versions of php-parser with dependencies

Informations about the package php-parser

PHP Parser

Coverage Status

This is a PHP 5.2 to PHP 8.0 parser written in PHP. Its purpose is to simplify static code analysis and manipulation.

Documentation for version 4.x (stable; for running on PHP >= 7.0; for parsing PHP 5.2 to PHP 8.0).

Documentation for version 3.x (unsupported; for running on PHP >= 5.5; for parsing PHP 5.2 to PHP 7.2).

Features

The main features provided by this library are:

Quick Start

Install the library using composer:

php composer.phar require nikic/php-parser

Parse some PHP code into an AST and dump the result in human-readable form:

This dumps an AST looking something like this:

Let's traverse the AST and perform some kind of modification. For example, drop all function bodies:

This gives us an AST where the Function_::$stmts are empty:

Finally, we can convert the new AST back to PHP code:

This gives us our original code, minus the var_dump() call inside the function:

For a more comprehensive introduction, see the documentation.

Documentation

  1. Introduction
  2. Usage of basic components

Component documentation:


Version
Requires php Version >=7.0
ext-tokenizer Version *

The package nikic/php-parser contains the following files

Loading the files please wait ....