PHPackages                             grom358/pharborist - 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. grom358/pharborist

AbandonedArchivedLibrary

grom358/pharborist
==================

Pharborist builds a syntax tree for PHP that can be traversed and manipulated.

4334.1k↓100%11[23 issues](https://github.com/grom358/pharborist/issues)[2 PRs](https://github.com/grom358/pharborist/pulls)PHP

Since Aug 15Pushed 10y ago5 watchersCompare

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

READMEChangelogDependenciesVersions (13)Used By (0)

pharborist
==========

[](#pharborist)

[![Pharborist logo](./docs/logo_128px.png "Pharborist logo")](./docs/logo_128px.png)

A PHP library to query and transform PHP source code via tree operations.

Roadmap
=======

[](#roadmap)

- Tests with 100% code coverage
- Integration with a third party library for PHPDoc comments
- API to ease querying and transforming of the syntax tree
- Build a PHP source code formatter using the library (Partially completed).
- Build a PHP code check using the library

Below is an example of how the API might look once its more developed:

```
// Add use declaration if it does not already exist. Use UtilityString alias if conflict
$alias = $tree->ensureUseDeclaration('Drupal\Component\Utility\String', 'UtilityString');
// Find all calls to check_plain and rename them to use String::checkPlain
$function_calls = $tree->find(Filter::functionCall('check_plain'));
foreach ($function_calls as $call) {
  $class_method_call = ClassMethodCallNode::create($alias, 'check_plain', $call->getArgumentList());
  $call->replaceWith($class_method_call);
}
```

Usage
=====

[](#usage)

```
require_once 'vendor/autoload.php';

use Pharborist\Parser;
use Pharborist\Namespaces\NamespaceNode;
use Pharborist\Filter;

$filename = $argv[1];
$tree = Parser::parseFile($filename);

// check there only one namespace declaration
$namespaces = $tree->children(Filter::isInstanceOf('\Pharborist\Namespaces\NamespaceNode'));
if ($namespaces->count() > 1) {
  die('More then one namespace at line ' . $namespaces[1]->getLineNumber() . PHP_EOL);
}
```

[![Build Status](https://camo.githubusercontent.com/c77325349972b87f5dbe4a7eb48eeba2c2a6697866f4ba204422624c3209a018/68747470733a2f2f7472617669732d63692e6f72672f67726f6d3335382f70686172626f726973742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/grom358/pharborist)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance9

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82% 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.

### Community

Maintainers

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

---

Top Contributors

[![grom358](https://avatars.githubusercontent.com/u/723993?v=4)](https://github.com/grom358 "grom358 (73 commits)")[![larowlan](https://avatars.githubusercontent.com/u/555254?v=4)](https://github.com/larowlan "larowlan (12 commits)")[![martinfrances107](https://avatars.githubusercontent.com/u/1259969?v=4)](https://github.com/martinfrances107 "martinfrances107 (1 commits)")[![nickschuch](https://avatars.githubusercontent.com/u/1459612?v=4)](https://github.com/nickschuch "nickschuch (1 commits)")[![pfrenssen](https://avatars.githubusercontent.com/u/442924?v=4)](https://github.com/pfrenssen "pfrenssen (1 commits)")[![webchick](https://avatars.githubusercontent.com/u/332535?v=4)](https://github.com/webchick "webchick (1 commits)")

### Embed Badge

![Health badge](/badges/grom358-pharborist/health.svg)

```
[![Health](https://phpackages.com/badges/grom358-pharborist/health.svg)](https://phpackages.com/packages/grom358-pharborist)
```

PHPackages © 2026

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