PHPackages                             facebook/definition-finder - 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. facebook/definition-finder

AbandonedArchivedLibrary

facebook/definition-finder
==========================

Find definitions in PHP or Hack files. Useful for autoloaders.

v2.16.0(4y ago)1142.6k↓74.1%104MITHack

Since Feb 8Pushed 3y ago17 watchersCompare

[ Source](https://github.com/hhvm/definition-finder)[ Packagist](https://packagist.org/packages/facebook/definition-finder)[ Docs](https://github.com/hhvm/definitions-finder)[ RSS](/packages/facebook-definition-finder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (58)Used By (4)

Definition Finder
=================

[](#definition-finder)

[![Continuous Integration](https://github.com/hhvm/definition-finder/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/hhvm/definition-finder/actions/workflows/build-and-test.yml)

This library finds all the definitions in a file or tree that HHVM understands. It is used to generate [the Hack reference documentation](http://docs.hhvm.com/hack/reference/), and be used for other purposes such as [generating autoload maps](https://github.com/hhvm/hhvm-autoload/)

This project requires HHVM 3.9 or later - however, if the code being scanned requires a later version of HHVM, definition-finder may not be able to parse it on the lower version.

Usage
-----

[](#usage)

There are three main entrypoints:

- [`FileParser::FromFile(string $filename)`](src/FileParser.php)
- [`FileParser::FromData(string $data, ?string $filename = null)`](src/FileParser.php)
- [`TreeParser::FromPath(string $path)`](src/TreeParser.php)

`FileParser` returns definitions from a single file, whereas `TreeParser` recurses over an entire directory tree. All 3 of these functions return an implementation of [`BaseParser`](src/BaseParser.php). There are three forms of accessors:

- `getClasses(): vec` - returns a `vec` of \[`ScannedClass`\](src/definitions/ScannedClass.php\], which has a similar interface to `ReflectionClass`
- `getClassNames(): vec` - returns a `vec` of class names
- `getClass(string $name): ScannedClass` - returns a `ScannedClass` for the specified class, or throws an exception if it was not found

Similar functions exist for interfaces, traits, constants, enums, and typedefs.

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

[](#installation)

```
hhvm composer require facebook/definition-finder

```

Status
------

[](#status)

The API is stable, and this is used in production to generate [the Hack reference documentation](http://docs.hhvm.com/hack/reference/).

Implementation
--------------

[](#implementation)

This is a recursive parser built on the token stream exposed by `token_get_all()`.

Contributing
============

[](#contributing)

We welcome GitHub issues and pull requests - please see CONTRIBUTING.md for details.

License
=======

[](#license)

definition-finder is [MIT-licensed](LICENSE).

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community32

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 90% 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 ~33 days

Recently: every ~139 days

Total

57

Last Release

1479d ago

Major Versions

v1.x-dev → v2.0.02018-06-28

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3757713?v=4)[Joel Marcey](/maintainers/JoelMarcey)[@JoelMarcey](https://github.com/JoelMarcey)

![](https://avatars.githubusercontent.com/u/601530?v=4)[Yang, Bo](/maintainers/Atry)[@Atry](https://github.com/Atry)

![](https://avatars.githubusercontent.com/u/727402?v=4)[Alexey Toptygin](/maintainers/alexeyt)[@alexeyt](https://github.com/alexeyt)

---

Top Contributors

[![fredemmott](https://avatars.githubusercontent.com/u/360927?v=4)](https://github.com/fredemmott "fredemmott (523 commits)")[![jjergus](https://avatars.githubusercontent.com/u/2483917?v=4)](https://github.com/jjergus "jjergus (27 commits)")[![lexidor](https://avatars.githubusercontent.com/u/31805625?v=4)](https://github.com/lexidor "lexidor (6 commits)")[![doublecompile](https://avatars.githubusercontent.com/u/4267230?v=4)](https://github.com/doublecompile "doublecompile (5 commits)")[![HRMsimon](https://avatars.githubusercontent.com/u/7907670?v=4)](https://github.com/HRMsimon "HRMsimon (4 commits)")[![alexeyt](https://avatars.githubusercontent.com/u/727402?v=4)](https://github.com/alexeyt "alexeyt (4 commits)")[![JoelMarcey](https://avatars.githubusercontent.com/u/3757713?v=4)](https://github.com/JoelMarcey "JoelMarcey (2 commits)")[![azjezz](https://avatars.githubusercontent.com/u/29315886?v=4)](https://github.com/azjezz "azjezz (2 commits)")[![Atry](https://avatars.githubusercontent.com/u/601530?v=4)](https://github.com/Atry "Atry (2 commits)")[![kilahm](https://avatars.githubusercontent.com/u/3050967?v=4)](https://github.com/kilahm "kilahm (2 commits)")[![wlin53](https://avatars.githubusercontent.com/u/26862692?v=4)](https://github.com/wlin53 "wlin53 (1 commits)")[![aloiret](https://avatars.githubusercontent.com/u/1227963?v=4)](https://github.com/aloiret "aloiret (1 commits)")[![jesseschalken](https://avatars.githubusercontent.com/u/1559204?v=4)](https://github.com/jesseschalken "jesseschalken (1 commits)")[![kmeht](https://avatars.githubusercontent.com/u/1120478?v=4)](https://github.com/kmeht "kmeht (1 commits)")

---

Tags

autoloadcomposer-pluginhacklanghhvmautoloadhhvmhackdefinitions

### Embed Badge

![Health badge](/badges/facebook-definition-finder/health.svg)

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

###  Alternatives

[hackpack/hackunit

An xUnit testing framework for Hack

612.7k14](/packages/hackpack-hackunit)

PHPackages © 2026

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