PHPackages                             carloswph/mainframe - 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. carloswph/mainframe

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

carloswph/mainframe
===================

Provides a container in which objects can be pushed, and then an interface to call methods that can be found inside the queued objects, and executed sequentially.

v1.0.0(5y ago)28MITPHP

Since Apr 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/carloswph/mainframe)[ Packagist](https://packagist.org/packages/carloswph/mainframe)[ RSS](/packages/carloswph-mainframe/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Mainframe
=========

[](#mainframe)

Deadly simple object container experiment that makes possible to call any methods existent in the injected objects directly through the container. If more than one object have the called function, all of them are executed. If no methods are found, then the container just ignores the calling.

Installation
============

[](#installation)

As usual, we prefer using Composer for managing dependencies, so this package can be installed using `composer require carloswph/mainframe`

Usage
=====

[](#usage)

Using Mainframe is actually quite simple. Let's consider we have two classes A and B, and want to inject them into the container. Injections can be made either during the container instantiation or thereafter, by using the method add(), as follows.

```
use Mainframe\Container;

require __DIR__ . '/vendor/autoload.php';

class A
{
	public function __construct() {}

	public function print($string)
	{
		echo $string;
	}

	public function method()
	{
		echo 'C';
	}
}

class B
{
	public function __construct() {}

	public function print()
	{
		echo 'B';
	}

	public function load()
	{
		echo 'Do something';
	}
}

$container = new Container(['class_a' => new A()]); // Class A instance injected as Container array
$container->add('class_b', new B()); // Class B instance being injected after instantiation, through add()
```

As a matter of controlling objects, all injected objects must have a key. That will allow Mainframe to gather and retrieve all of their methods using Reflection, which will generate a databank where objects and methods names are stored for being called later. Now we have both objects inside the container, we can use all of their methods through the container, directly.

Also, you can specifically target a particular method in a particular instance, by using the virtual method terminal($key, $methodName, $args).

```
$container->print(); // Calls only class B print()
$container->print('Test'); // Calls both class A and B print() methods
$container->method(); // Calls class A method()
$container->terminal('class_a', 'print', 'Test'); // Calls specifically class A print() and pass 'Test' as argument
```

More
----

[](#more)

As an extension of PHP's ArrayObject class, Mainframe is able to accepted any of this class existent methods. However, to make it easier, additional aliases will be created for managing the injected objects.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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

Unknown

Total

1

Last Release

1872d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/13c91dcf5209989038da335ba42538fa84670bf27400f220d182a76e0a720b74?d=identicon)[carloswph](/maintainers/carloswph)

---

Top Contributors

[![meuppt](https://avatars.githubusercontent.com/u/37983141?v=4)](https://github.com/meuppt "meuppt (2 commits)")[![carloswph](https://avatars.githubusercontent.com/u/78516217?v=4)](https://github.com/carloswph "carloswph (1 commits)")

---

Tags

containerdependency-injectionreflectiondiarrayobjectmagic methods

### Embed Badge

![Health badge](/badges/carloswph-mainframe/health.svg)

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

###  Alternatives

[php-di/php-di

The dependency injection container for humans

2.8k48.9M994](/packages/php-di-php-di)[aura/di

A serializable dependency injection container with constructor and setter injection, interface and trait awareness, configuration inheritance, and much more.

356968.3k58](/packages/aura-di)[mrclay/props-dic

Props is a simple DI container that allows retrieving values via custom property and method names

3611.7M3](/packages/mrclay-props-dic)[slince/di

A flexible dependency injection container

20260.4k6](/packages/slince-di)[capsule/di

A PSR-11 compliant autowiring dependency injection container.

2857.5k2](/packages/capsule-di)

PHPackages © 2026

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