PHPackages                             stracker-phil/wpdi - 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. stracker-phil/wpdi

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

stracker-phil/wpdi
==================

Truly WordPress-native dependency injection

1.1.1(1mo ago)121GPL-2.0PHPPHP &gt;=7.4

Since Nov 17Pushed 1mo agoCompare

[ Source](https://github.com/stracker-phil/wpdi)[ Packagist](https://packagist.org/packages/stracker-phil/wpdi)[ RSS](/packages/stracker-phil-wpdi/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (12)Versions (6)Used By (0)

[![Ask DeepWiki](https://camo.githubusercontent.com/0f5ae213ac378635adeb5d7f13cef055ad2f7d9a47b36de7b1c67dbe09f609ca/68747470733a2f2f6465657077696b692e636f6d2f62616467652e737667)](https://deepwiki.com/stracker-phil/wpdi)

WPDI - WordPress Dependency Injection
=====================================

[](#wpdi---wordpress-dependency-injection)

Lightweight, WordPress-native dependency injection with auto-discovery and zero configuration.

Features
--------

[](#features)

- **Zero Config** - Autowires concrete classes in `src/` folder
- **Production Ready** - Cached class mapping; only modified files re-scanned during development
- **WordPress Native** - Follows WordPress coding standards
- **PSR-11 Compatible** - Standard container interface
- **Opinionated** - Limited feature-set by design

Philosophy
----------

[](#philosophy)

> "Constraint is the feature"

In my experience, DI usually fails in WordPress projects not because they lack features, but because they have too many. It's easy for developers to misuse the container as a global registry, a configuration store, a service locator - all patterns that DI was meant to solve.

WPDI prevents these patterns by design. It does one thing well: wire your classes together automatically. Everything else—configuration, state, WordPress options—stays where it belongs.

Quick Start
-----------

[](#quick-start)

```
