PHPackages                             lkrms/dice - 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. lkrms/dice

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

lkrms/dice
==========

A minimalist dependency injection container for PHP. Forked from level-2/dice.

v4.1.12(6mo ago)3103.8k↓27.1%3BSD-2-ClausePHPPHP &gt;=7.0

Since May 6Pushed 6mo agoCompare

[ Source](https://github.com/lkrms/Dice)[ Packagist](https://packagist.org/packages/lkrms/dice)[ Docs](https://github.com/lkrms/Dice)[ RSS](/packages/lkrms-dice/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (36)Used By (3)

> **Note:** this is a fork of [Tom Butler's project](https://github.com/Level-2/Dice). It reflects the requirements and priorities of a [PHP toolkit](https://github.com/lkrms/php-util) that uses it, which may or may not align with your own.

[Dice PHP Dependency Injection Container](https://r.je/dice.html)
=================================================================

[](#dice-php-dependency-injection-container)

Dice is a minimalist Dependency Injection Container for PHP with a focus on being lightweight and fast as well as requiring as little configuration as possible.

Project Goals
-------------

[](#project-goals)

1. To be lightweight and not a huge library with dozens of files (Dice is a single class) yet support all features (and more) offered by much more complex containers
2. To "just work". Basic functionality should work with zero configuration
3. Where configuration is required, it should be as minimal and reusable as possible as well as easy to use.
4. Speed! (See [the section on performance](#performance))

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

[](#installation)

Install the latest version of this fork with [Composer](https://getcomposer.org/):

```
composer require lkrms/dice
```

Alternatively, include the lightweight `Dice.php` in your project and it's usable without any further configuration:

Simple example:

```
