PHPackages                             nazg/glue - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. nazg/glue

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

nazg/glue
=========

Dependency Injection Container For HHVM/Hack

1.5.1(5y ago)311.0k2MITHack

Since Jan 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/nazg-hack/glue)[ Packagist](https://packagist.org/packages/nazg/glue)[ Docs](https://github.com/nazg-hack/glue)[ RSS](/packages/nazg-glue/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (7)Versions (13)Used By (2)

Nazg\\Glue
==========

[](#nazgglue)

Dependency Injection Container For Hack

[![Travis (.org)](https://camo.githubusercontent.com/50fec8cfa63f0661d7e6529793709e95193f467ef42edd011f7c2a179cb86633/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6e617a672d6861636b2f676c75652e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/nazg-hack/glue)[![Packagist](https://camo.githubusercontent.com/9479ab24586d3a4436b3153c6e34137147b602a6cb4e13b518a6497bd5a0b89a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e617a672f676c75652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nazg/glue)[![Packagist Version](https://camo.githubusercontent.com/b857959cedab6dca19a084273b47429931dc35b013faa99853f7e3854fde5846/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e617a672f676c75652e7376673f636f6c6f723d6f72616e6765267374796c653d666c61742d737175617265)](https://packagist.org/packages/nazg/glue)[![Packagist](https://camo.githubusercontent.com/1b3faaa3c213b31fa76a1f860cd42a6e47c09e9f418353fdf89822da6dfbb37b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e617a672f676c75652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nazg/glue)

Requirements
------------

[](#requirements)

HHVM 4.35.0 and above.

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

[](#installation)

Composer is the recommended installation method.
To add Nazg\\Glue to your project, add the following to your composer.json then re-run composer:

```
  "require": {
    "nazg/glue": "^1.4"
  }
```

Run Composer commands using HHVM like so:

```
$ composer install
```

In addition, you will need to use hhvm-autoload as your autoloader.

or

```
$ composer require nazg/glue
```

Usage
-----

[](#usage)

### First steps

[](#first-steps)

#### Create Class

[](#create-class)

```
interface AnyInterface {

}
```

```
final class Any implements AnyInterface {
  // any
}
```

#### Bindings

[](#bindings)

```
use type Nazg\Glue\Container;
use type Nazg\Glue\Scope;

$container = new Container();
$container->bind(AnyInterface::class)
  ->to(Mock::class)
  ->in(Scope::PROTOTYPE);
\HH\Asio\join($container->lockAsync());
```

dependencies will be automatically resolved

```
$container->get(AnyInterface::class);
```

### Scopes

[](#scopes)

use the `Nazg\Glue\Scope` enum.

```
enum Scope : int {
  PROTOTYPE = 0;
  SINGLETON = 1;
}
```

enum`Nazg\Glue\Scope\PROTOTYPE`single instance`Nazg\Glue\Scope\SINGLETON`prototype instance### Providers

[](#providers)

use \\Nazg\\Glue\\ProviderInterface.

```
use type Nazg\Glue\ProviderInterface;

final class AnyProvider implements ProviderInterface {

  public function get(): AnyInterface {
    return new Any();
  }
}
```

```
$container->bind(AnyInterface::class)
  ->provider(new AnyProvider();
```

### Binding Serialization Cache

[](#binding-serialization-cache)

```
use type Nazg\Glue\ContainerBuilder;

$builder = new ContainerBuilder(true, 'apc.cache.key.name');
// return a \Nazg\Glue\CachedContainer Instance
$container = $builder->make();
```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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

Every ~49 days

Recently: every ~82 days

Total

12

Last Release

2142d ago

Major Versions

0.2.0 → 1.0.02019-03-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/47817f3dd2890864096bd77ee772ec46061432f128988ca23939b0ca486d7bc3?d=identicon)[ytake](/maintainers/ytake)

---

Top Contributors

[![ytake](https://avatars.githubusercontent.com/u/4454078?v=4)](https://github.com/ytake "ytake (37 commits)")

---

Tags

dependency-injectionhacklanghhvmservicelocatorcontainerhhvmhack

### Embed Badge

![Health badge](/badges/nazg-glue/health.svg)

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

PHPackages © 2026

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