PHPackages                             tourze/php-packer-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. tourze/php-packer-parser

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

tourze/php-packer-parser
========================

PHP代码解析器，用于处理PHP代码及其依赖的解析和处理

0.0.1(1y ago)07MITPHPPHP ^8.1CI passing

Since Apr 17Pushed 11mo ago1 watchersCompare

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

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

PHP Packer Parser
=================

[](#php-packer-parser)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/682d87f660778f232c7a2f36e27a7db38c836507207866f50ce573564da5eebb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f7068702d7061636b65722d7061727365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/php-packer-parser)[![Build Status](https://camo.githubusercontent.com/0e4e44deb3fedad964afe6bcf7425f3cd9262d3196408c856b947c456bf467f7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f75727a652f7068702d7061636b65722d7061727365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/tourze/php-packer-parser)[![Quality Score](https://camo.githubusercontent.com/96164a5f7a27e74e7a58de56737d8239e2823dbbe6a9c6eb438c43ec4ca337b3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f7068702d7061636b65722d7061727365722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/php-packer-parser)[![Total Downloads](https://camo.githubusercontent.com/55c5b85379fc82e922d4451e50015687e8dc7de91ff90d7aadb262c6ab880007/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f7068702d7061636b65722d7061727365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/php-packer-parser)

PHP Packer Parser is an advanced PHP code parser and dependency analyzer library. Built on top of PHP Packer AST and PHP Packer Analysis, it provides a simple API to recursively parse PHP files, track dependencies, support PSR-4 autoloading and performance profiling.

Features
--------

[](#features)

- Recursively parse PHP files and their dependencies
- Track and analyze file dependencies
- PSR-4 compatible namespace mapping and file resolution
- Performance timing and monitoring
- Robust error handling and exception mechanism
- Highly customizable parser configuration

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

[](#installation)

Requires PHP 8.1 or above.

Install via Composer:

```
composer require tourze/php-packer-parser
```

Quick Start
-----------

[](#quick-start)

### Parse PHP files and dependencies

[](#parse-php-files-and-dependencies)

```
use PhpPacker\Parser\ParserFactory;

// Create a parser
$parser = ParserFactory::create(
    '/path/to/entry.php',
    ['*vendor/symfony/*', '*tests/*'] // Exclude patterns
);

// Parse entry file and all dependencies
$parser->parse('/path/to/entry.php');

// Get processed files
$processedFiles = $parser->getProcessedFiles();

// Get dependencies
$dependencies = $parser->getDependencies();
```

### Custom configuration

[](#custom-configuration)

```
use PhpPacker\Parser\Config\ParserConfig;
use PhpPacker\Parser\ParserFactory;

$config = new ParserConfig();
$config->setEnableStopwatch(true);
$config->setMaxRecursionDepth(50);

$parser = ParserFactory::create('/path/to/entry.php', [], $config);
```

### PSR-4 Loader usage

[](#psr-4-loader-usage)

```
use PhpPacker\Parser\Psr4Loader;

$loader = new Psr4Loader('/path/to/vendor');
$psr4Map = $loader->getPsr4Map();
$paths = $loader->findPossiblePaths('Namespace\\Class');
```

Documentation
-------------

[](#documentation)

- Advanced configuration: logging, recursion depth, AST cache and more
- See source code and unit tests for detailed API usage

Contributing
------------

[](#contributing)

Pull requests and issues are welcome! Please follow PSR-12 coding standards and ensure all PHPUnit tests pass before submitting.

License
-------

[](#license)

MIT License © tourze

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance49

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

396d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[wikimedia/parsoid

Parsoid, a bidirectional parser between wikitext and HTML5

171524.3k1](/packages/wikimedia-parsoid)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[antlr/antlr4-php-runtime

PHP 8.0+ runtime for ANTLR 4

96636.7k13](/packages/antlr-antlr4-php-runtime)[jkphl/micrometa

A meta parser for extracting micro information out of web documents, currently supporting Microformats 1+2, HTML Microdata, RDFa Lite 1.1 and JSON-LD

114163.8k1](/packages/jkphl-micrometa)[symfony/json-streamer

Provides powerful methods to read/write data structures from/into JSON streams.

14440.0k8](/packages/symfony-json-streamer)[matecat/xliff-parser

A Xliff parser written in PHP

14127.5k](/packages/matecat-xliff-parser)

PHPackages © 2026

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