PHPackages                             fredemmott/hhvm-autoload - 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. fredemmott/hhvm-autoload

Abandoned → [facebook/hhvm-autoload](/?search=facebook%2Fhhvm-autoload)Composer-plugin[Utility &amp; Helpers](/categories/utility)

fredemmott/hhvm-autoload
========================

v1.3.0(9y ago)03901Hack

Since Feb 15Pushed 5y agoCompare

[ Source](https://github.com/fredemmott/hhvm-autoload)[ Packagist](https://packagist.org/packages/fredemmott/hhvm-autoload)[ RSS](/packages/fredemmott-hhvm-autoload/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (9)Used By (1)

HHVM-Autoload [![Build Status](https://camo.githubusercontent.com/3f7303ffc63b93388447967da04aee473bfff06077f60424c3befec352ff348d/68747470733a2f2f7472617669732d63692e6f72672f6868766d2f6868766d2d6175746f6c6f61642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hhvm/hhvm-autoload)
===================================================================================================================================================================================================================================================================================================

[](#hhvm-autoload-)

A Composer plugin for autoloading classes, enums, functions, typedefs, and constants on HHVM.

FAQ
===

[](#faq)

Do I need to use Hack?
----------------------

[](#do-i-need-to-use-hack)

No, PHP is fine - but HHVM is required because:

- PHP does not support autoloading anything other than classes
- this project and the parser are written in Hack

Can I autoload functions and constants if I'm not writing Hack?
---------------------------------------------------------------

[](#can-i-autoload-functions-and-constants-if-im-not-writing-hack)

Yes :)

Why does this project use Composer's autoloader?
------------------------------------------------

[](#why-does-this-project-use-composers-autoloader)

It can't depend on itself :)

Preview Warning
===============

[](#preview-warning)

The autoload mechanism itself is very heavily tested at Facebook, however [the library](https://github.com/hhvm/definition-finder/) used to find the autoloadables (classes, functions, etc) is fairly new, and has not been used on a wide variety of projects. It's been tested on:

- The PHP and Hack code inside HHVM and Hack
- [The Hack/HHVM documentation site](https://github.com/hhvm/user-documentation/)
- [The dependencies](https://github.com/hhvm/user-documentation/blob/master/composer.lock) of the Hack/HHVM documentation site

If you encounter a parse error, please [file an issue](https://github.com/hhvm/definition-finder/issues) against [hhvm/definition-finder](https://github.com/hhvm/definition-finder/) with either example code, or a link to an open source project that it can't parse.

For any other issue, please [file an issue](https://github.com/hhvm/hhvm-autoload/issues) against [this project](https://github.com/hhvm/hhvm-autoload).

Usage
=====

[](#usage)

1. Add an `hh_autoload.json` file (see section below) and optionally remove your configuration from composer.json
2. `composer require facebook/hhvm-autoload`
3. Replace any references to `vendor/autoload.php` with `vendor/hh_autoload.php`
4. If you are using PHPUnit, you will need to add `vendor/hh_autoload.php` to your `bootstrap.php`, or to `phpunit.xml` as a `bootstrap` file if you don't already have one. This is because PHPUnit automatically loads `vendor/autoload.php`, but is not aware of `vendor/hh_autoload.php`
5. To re-generate the map, run `composer dump-autoload` or any other command that generates the map

Configuration (`hh_autoload.json`)
==================================

[](#configuration-hh_autoloadjson)

A minimal configuration file is:

```
{
  "roots": [ "src/" ]
}
```

This will look for autoloadable definitions in `src/`, and also look in `vendor/`. It will pay attention to the `autoload` sections of `composer.json` inside the `vendor/` directory.

The following settings are optional:

- `"extraFiles": ["file1.php"]` - files that should not be autoloaded, but should be `require()`ed by `vendor/hh_autoload.php`. This should be needed much less frequently than under Composer
- `"includeVendor": false` - do not include `vendor/` definitions in `vendor/hh_autoload.php`
- `"autoloadFilesBehavior": "scan"|"exec"` - whether autoload `files` from vendor should be `scan`ned for definitions, or `exec`uted by `vendor/hh_autoload.php` - `scan` is the default, and generally favorable, but `exec` is needed if you have dependencies that need code to be executed on startup. `scan` is sufficient if your dependencies just use `files` because they need to define things that aren't classes, which is usually the case.

How It Works
============

[](#how-it-works)

- [`facebook/definition-finder`](https://github.com/facebook/definition-finder/) provides a list of all PHP and Hack definitions in the specified locations
- This is used to generate something similar to a classmap, except including other kinds of definitions
- The map is provided to HHVM with [`HH\autoload_set_paths()`](https://docs.hhvm.com/hack/reference/function/HH.autoload_set_paths/)

The [Composer plugin API](https://getcomposer.org/doc/articles/plugins.md) allows it to re-generate the `vendor/hh_autoload.php` file automatically whenever Composer itself regenerates `vendor/autoload.php`

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

[](#contributing)

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

License
=======

[](#license)

hhvm-autoload is [BSD-licensed](LICENSE). We also provide an additional [patent grant](PATENTS).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 93.4% 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 ~1 days

Total

3

Last Release

3420d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/66d33e29918fd8cc713997dbbe03cb86e2aefbdc6736637641cdffed2f22accb?d=identicon)[fredemmott](/maintainers/fredemmott)

---

Top Contributors

[![fredemmott](https://avatars.githubusercontent.com/u/360927?v=4)](https://github.com/fredemmott "fredemmott (57 commits)")[![GroovyCarrot](https://avatars.githubusercontent.com/u/5589906?v=4)](https://github.com/GroovyCarrot "GroovyCarrot (1 commits)")[![HRMsimon](https://avatars.githubusercontent.com/u/7907670?v=4)](https://github.com/HRMsimon "HRMsimon (1 commits)")[![jesseschalken](https://avatars.githubusercontent.com/u/1559204?v=4)](https://github.com/jesseschalken "jesseschalken (1 commits)")[![simonwelsh](https://avatars.githubusercontent.com/u/125915?v=4)](https://github.com/simonwelsh "simonwelsh (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fredemmott-hhvm-autoload/health.svg)

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

###  Alternatives

[symfony/runtime

Enables decoupling PHP applications from global state

74794.9M945](/packages/symfony-runtime)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5344.1M527](/packages/drupal-core-composer-scaffold)[drupal/core-project-message

Adds a message after Composer installation.

2124.0M194](/packages/drupal-core-project-message)[sandersander/composer-link

Adds ability to link local packages for development with composer

94441.4k](/packages/sandersander-composer-link)[phpro/grumphp-shim

GrumPHP Phar distribution

284.6M334](/packages/phpro-grumphp-shim)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41759.2k3](/packages/lullabot-drainpipe)

PHPackages © 2026

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