PHPackages                             pharborist/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pharborist/pharborist

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pharborist/pharborist
=====================

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

1864[1 PRs](https://github.com/pharborist/pharborist/pulls)PHPCI passing

Since Aug 15Pushed 3mo agoCompare

[ Source](https://github.com/pharborist/pharborist)[ Packagist](https://packagist.org/packages/pharborist/pharborist)[ RSS](/packages/pharborist-pharborist/feed)WikiDiscussions master Synced 3w 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. Originally built for . Very minimally maintained. Unless another project explicitly requires this, [use Rector instead](https://getrector.com/).

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);
}
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance53

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.3% 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://avatars.githubusercontent.com/u/329663?v=4)[Joao Ventura](/maintainers/jcnventura)[@jcnventura](https://github.com/jcnventura)

---

Top Contributors

[![grom358](https://avatars.githubusercontent.com/u/723993?v=4)](https://github.com/grom358 "grom358 (73 commits)")[![goba](https://avatars.githubusercontent.com/u/235185?v=4)](https://github.com/goba "goba (22 commits)")[![larowlan](https://avatars.githubusercontent.com/u/555254?v=4)](https://github.com/larowlan "larowlan (12 commits)")[![andriokha](https://avatars.githubusercontent.com/u/3338309?v=4)](https://github.com/andriokha "andriokha (7 commits)")[![jcnventura](https://avatars.githubusercontent.com/u/329663?v=4)](https://github.com/jcnventura "jcnventura (3 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/pharborist-pharborist/health.svg)

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

###  Alternatives

[wavey/sweetalert

SweetAlert2 implementation for Laravel

497.8k](/packages/wavey-sweetalert)

PHPackages © 2026

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