PHPackages                             datto/php-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. datto/php-parser

AbandonedArchivedLibrary[Parsing &amp; Serialization](/categories/parsing)

datto/php-parser
================

Define and parse a context-free grammar

3.1.0(10y ago)3118[1 issues](https://github.com/datto/php-parser/issues)LGPL-3.0PHPPHP &gt;=5.3.0

Since Apr 13Pushed 10y ago5 watchersCompare

[ Source](https://github.com/datto/php-parser)[ Packagist](https://packagist.org/packages/datto/php-parser)[ Docs](http://datto.com)[ RSS](/packages/datto-php-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

Parser for PHP
==============

[](#parser-for-php)

Specifies the rules that define your context-free grammar, and then gain the ability to parse any text source. The output is an abstract syntax tree ready for semantic analysis.

Features
--------

[](#features)

- Powerful recursive-descent parser
- 100% unit-test coverage
- Ultra-lightweight (just one small file)

Requirements
------------

[](#requirements)

- PHP &gt;= 5.3

License
-------

[](#license)

This package is released under an open-source license: [LGPL-3.0](https://www.gnu.org/licenses/lgpl-3.0.html)

Installation
------------

[](#installation)

If you're using [Composer](https://getcomposer.org/), you can use this package ([datto/php-parser](https://packagist.org/packages/datto/php-parser)) by inserting a line into the "require" section of your "composer.json" file:

```
        "datto/php-parser": "~3.0"

```

Unit tests
----------

[](#unit-tests)

You can run the suite of unit tests from the project directory like this:

```
./vendor/bin/phpunit
```

Author
------

[](#author)

[Spencer Mortensen](http://spencermortensen.com/contact/)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Total

5

Last Release

3932d ago

Major Versions

1.0.0 → 2.0.02015-06-18

2.0.0 → 3.0.02015-08-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb044681aa172ced7a03b093bda1f1f1031831133281d3d1e036807d28260c31?d=identicon)[datto-packagist-maintainer](/maintainers/datto-packagist-maintainer)

---

Top Contributors

[![smortensen](https://avatars.githubusercontent.com/u/2285119?v=4)](https://github.com/smortensen "smortensen (8 commits)")

---

Tags

phpparserparsegrammarcontext-freerecursive

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/datto-php-parser/health.svg)

```
[![Health](https://phpackages.com/badges/datto-php-parser/health.svg)](https://phpackages.com/packages/datto-php-parser)
```

###  Alternatives

[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k910.8M118](/packages/doctrine-lexer)[simplehtmldom/simplehtmldom

A fast, simple and reliable HTML document parser for PHP.

1921.3M14](/packages/simplehtmldom-simplehtmldom)[adci/full-name-parser

Parses a human name

29714.4k5](/packages/adci-full-name-parser)[corveda/php-sandbox

A PHP library that can be used to run PHP code in a sandboxed environment

23483.5k2](/packages/corveda-php-sandbox)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[leonelquinteros/php-toml

PHP parser for TOML language ( https://github.com/toml-lang/toml )

266.7k](/packages/leonelquinteros-php-toml)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
