PHPackages                             phug/dependency-injection - 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. [Templating &amp; Views](/categories/templating)
4. /
5. phug/dependency-injection

ActiveLibrary[Templating &amp; Views](/categories/templating)

phug/dependency-injection
=========================

Phug dependency injection engine

2.0.1(2y ago)291.0k—2.4%2MITPHP

Since Feb 23Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/phug-php/dependency-injection)[ Packagist](https://packagist.org/packages/phug/dependency-injection)[ Docs](http://phug-lang.com)[ GitHub Sponsors](https://github.com/kylekatarnls)[ Fund](https://opencollective.com/pug-php)[ RSS](/packages/phug-dependency-injection/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (2)Versions (60)Used By (2)

Phug Dependency Injection
=========================

[](#phug-dependency-injection)

What is Phug Dependency Injection?
----------------------------------

[](#what-is-phug-dependency-injection)

This project allow to provide helpers functions and values, to require them and to dump all required dependencies as a PHP array export.

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

[](#installation)

Install via Composer

```
composer require phug/dependency-injection
```

Usage
-----

[](#usage)

```
use Phug\DependencyInjection;

$dependencies = new DependencyInjection();
$dependencies->register('limit', 42);
$dependencies->provider('clock', static function () {
    return new Clock();
});

$dependencies->provider('expiration', ['clock', 'limit', static function (ClockInterface $clock, $limit) {
    return static function ($margin) use ($clock, $limit) {
        $delta = $limit - $margin;

        return $clock->now()->modify("$delta days");
    };
}]);

$expiration = $dependencies->call('expiration'); // return new DateTimeImmutable('now + 42 days')
$expiration = $dependencies->call('expiration', 20); // return new DateTimeImmutable('now + 22 days')
```

Security contact information
----------------------------

[](#security-contact-information)

To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance53

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 97% 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 ~68 days

Recently: every ~4 days

Total

36

Last Release

1035d ago

Major Versions

0.1.0 → 1.0.02017-03-10

1.12.3 → 2.0.12023-09-02

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/75a80e0830e63c723808d021d3a1648a2643db60f4ac2e40842da05f227f956b?d=identicon)[TorbenKoehn](/maintainers/TorbenKoehn)

---

Top Contributors

[![kylekatarnls](https://avatars.githubusercontent.com/u/5966783?v=4)](https://github.com/kylekatarnls "kylekatarnls (65 commits)")[![TorbenKoehn](https://avatars.githubusercontent.com/u/1403556?v=4)](https://github.com/TorbenKoehn "TorbenKoehn (2 commits)")

---

Tags

dependency-injectionphpphugpugtemplate-enginephpdependency-injectionhtmltemplatejadeviewsrenderpugphtmlpresentationdialectphug

### Embed Badge

![Health badge](/badges/phug-dependency-injection/health.svg)

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

###  Alternatives

[phug/phug

Pug (ex-Jade) facade engine for PHP, HTML template engine structured by indentation

66301.0k14](/packages/phug-phug)[talesoft/tale-pug

A clean, lightweight and easy-to-use templating engine for PHP based on Pug, formerly Jade

319.5k3](/packages/talesoft-tale-pug)[talesoft/tale-jade

A clean, lightweight and easy-to-use templating engine for PHP based on Jade/Pug

8819.3k5](/packages/talesoft-tale-jade)[figdice/figdice

Template Engine, XML-centric and attribute-driven

212.4k1](/packages/figdice-figdice)

PHPackages © 2026

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