PHPackages                             wpfulcrum/container - 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. [Framework](/categories/framework)
4. /
5. wpfulcrum/container

ActiveLibrary[Framework](/categories/framework)

wpfulcrum/container
===================

Fulcrum DI Container Module - a simple Dependency Injection Container that extends Pimple.

3.0.5(8y ago)212MITPHPPHP ^5.6|^7

Since Nov 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/wpfulcrum/container)[ Packagist](https://packagist.org/packages/wpfulcrum/container)[ Docs](https://github.com/wpfulcrum/container)[ RSS](/packages/wpfulcrum-container/feed)WikiDiscussions develop Synced 3d ago

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

Container Module
================

[](#container-module)

[![Build Status](https://camo.githubusercontent.com/eaa1d7bce695b080f91f508e2ffe226bd3efb11ddc30507c14814892f9d93f89/68747470733a2f2f7472617669732d63692e6f72672f777066756c6372756d2f636f6e7461696e65722e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/wpfulcrum/container)[![Latest Stable Version](https://camo.githubusercontent.com/6dd9579fe807435b62cca52edbc61f600970e1ff42c89b73591e4ef9b7ad7ae8/68747470733a2f2f706f7365722e707567782e6f72672f777066756c6372756d2f636f6e7461696e65722f762f737461626c65)](https://packagist.org/packages/wpfulcrum/container)[![License](https://camo.githubusercontent.com/27ce9648f17fd5dc647177dd3837296f16fc30b7eda652f97cf596633edc1c40/68747470733a2f2f706f7365722e707567782e6f72672f777066756c6372756d2f636f6e7461696e65722f6c6963656e7365)](https://packagist.org/packages/wpfulcrum/container)

The Fulcrum DI Container Module provides a lean Dependency Injection Container.

The primary purpose of a a DI Container is to manage objects. By passing in a closure that wraps up the creation of objects, using the container, you can:

1. Create a new object without having to use `new` in your code or having to specify it's dependencies.
2. Get an object out of the container without having to use Singletons, statics, or globals. WooHoo!

The container also stores datasets. Think of it like a big array where you add values into it by a unique key. Powerful.

Seriously, a DI Container makes you job so much easier. Let it handle:

1. Object creation along with all of the object's dependencies.
2. Managing objects.
3. Storing datasets in memory.
4. Retrieving the object or dataset you need.

Functionality
-------------

[](#functionality)

It extends [Pimple](https://pimple.symfony.com/) by providing the following functionality:

1. `has()` method to check if a unique key exists in the container.
2. `get()` method to fetch something out of the container by it's unique key.
3. `registerConcrete()` method - providing the ability to register a closure.

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

[](#installation)

The best way to use this component is through Composer:

```
composer require wpfulcrum/container

```

Basic Usage
-----------

[](#basic-usage)

### Creating Objects

[](#creating-objects)

Using the `registerConcrete()` method, you can register a closure that then handles creating the object and its dependencies.

For example, let's say you have an object that has several dependencies. For example, you are adding a Portfolio custom post type to your project using Fulcrum.

This might be the configuration for that CPT:

```
$concreteConfig = [
    'autoload' => true,
    'concrete' => function ($container) {
        $configObj = new Config(YOURPLUGIN_PATH . '/config/post-type/portfolio.php');

        return new PostType(
            $configObj,
            $configObj->postTypeName,
            new PostTypeSupports($configObj)
        );
    },
];

```

Let's stop and notice a few points:

1. There are multiple dependencies including:
    - a `Config` object
    - a post type name
    - PostTypeSupports` object.
2. Everything you need to create the CPT object is wrapped up in that closure.
3. The `autoload` parameter is set to `true`. Therefore, the object is created immediately upon registering it into the container.

Using the above configuration, it can be registered into the container like this:

```
$container = new DIContainer();
$portfolioCpt = $container->registerConcrete($concreteConfig, 'portfolio_cpt');

```

Contributing
------------

[](#contributing)

All feedback, bug reports, and pull requests are welcome.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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 ~3 days

Total

6

Last Release

3069d ago

PHP version history (2 changes)3.0.0PHP ^5.6||^7

3.0.1PHP ^5.6|^7

### Community

Maintainers

![](https://www.gravatar.com/avatar/01bb38cdf9dc0fc5ed69cd6d114c0ffe27f764bd2eefa62ca38d03f4c8ae8110?d=identicon)[hellofromtonya](/maintainers/hellofromtonya)

---

Top Contributors

[![hellofromtonya](https://avatars.githubusercontent.com/u/7284611?v=4)](https://github.com/hellofromtonya "hellofromtonya (14 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/wpfulcrum-container/health.svg)

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

###  Alternatives

[corneltek/cliframework

Command-line framework for PHP

435160.5k16](/packages/corneltek-cliframework)[htmlburger/wpemerge

A micro framework which modernizes WordPress as a CMS development by providing tools to implement MVC and more.

456137.8k8](/packages/htmlburger-wpemerge)[vlucas/bulletphp

A heierarchical resource-oriented micro-framework built on nested closures instead of route-based callbacks

41949.9k1](/packages/vlucas-bulletphp)[mouf/pimple-interop

This project is a very simple extension to the Pimple microframework. It adds to Pimple compatibility with the container-interop APIs.

102.4M2](/packages/mouf-pimple-interop)[php-di/silex-bridge

PHP-DI integration in Silex

2465.4k1](/packages/php-di-silex-bridge)[rmp-up/wp-di

Simple Dependency Injection / Service Container for more OOP in WordPress (PSR-11 compatible)

168.8k](/packages/rmp-up-wp-di)

PHPackages © 2026

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