PHPackages                             ixmanuel/nexus - 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. ixmanuel/nexus

ActiveLibrary

ixmanuel/nexus
==============

It manages object's dependencies for internal builders collaborators.

1.0.0(9y ago)066MITPHPPHP &gt;=7.0.0

Since Apr 10Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ixmanuel/nexus)[ Packagist](https://packagist.org/packages/ixmanuel/nexus)[ Docs](https://github.com/ixmanuel/nexus)[ RSS](/packages/ixmanuel-nexus/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

[![Build Status](https://camo.githubusercontent.com/705c3f03df07a524a29a19ac1aff6a479efbe8a08b89afeb2ebfdc4e057780a6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f69786d616e75656c2f6e657875732f6d61737465722e737667)](https://travis-ci.org/ixmanuel/nexus.svg)

Mapping dependencies at construction time
=========================================

[](#mapping-dependencies-at-construction-time)

This registers collaborators (dependencies) in the constructors in order to decouple the object creation in methods.

### Keywords

[](#keywords)

inversion control, dependency injection, builder

### Goal

[](#goal)

Testable, reusable and maintainable code by avoiding hard-coded references in methods.

### Benefits

[](#benefits)

- Creating collaborators (a.k.a. dependencies) only in constructors.
- Avoiding a global dependency injection container.
- Switching default implementations with alternatives and test's objects.

### Advantages of the language

[](#advantages-of-the-language)

- Referencing of classes and interfaces with its namespace.

### Alternatives

[](#alternatives)

- Usage of mapping.
- Anonymous classes.
- Passing empty objects that create those which are fully identifiable.
- Defining and implementing an interface for each collaboration.

### Here is an example that reconstitutes an entity from a data store.

[](#here-is-an-example-that-reconstitutes-an-entity-from-a-data-store)

###### You just need to pass the interface and its implementation.

[](#you-just-need-to-pass-the-interface-and-its-implementation)

```
    // It reconstitutes a person from a data store: PersonID is a kind
    // of Identity as much as an AboutMe is a kind of About and both
    // of them are collaborators. Take note that the creation is
    // delayed until need it, but it is not a Singleton.

    // Testing purposes.
    $person = new PersonFromStore(
        new FetchedPerson($id), TestPersonID::class, AboutMe::class
    );

    // Application.
    $person = new PersonFromStore(
        new FetchedPerson($id), PersonID::class, AboutMe::class
    );

    // Description
    final class PersonFromStore implements Party
    {
        private $record;
        private $identity;
        private $about;

        public function __construct(IdentityRecord $record, string $identity, string $about)
        {
            $this->record = $record;

            $this->identity = new Assignment(Identity::class, $identity);

            $this->about = new Assignment(About::class, $about);
        }

        // Please, your ID?
        public function identity() : Identity
        {
            // It calls the main constructor or the operator "new" in the ID class.
            // Same as: new PersonID(...)
            return $this->identity->new($this->record->key());
        }

        // Tell me something about you.
        public function about() : About
        {
            // It calls a convenience constructor in the AboutMe class.
            // Same as: AboutMe::withID(...)
            return $this->about->withID($this->identity());
        }
    }
```

### A proposal for the php community.

[](#a-proposal-for-the-php-community)

```
    // Definition
    final class PersonFromStore implements Party
    {
        // It can use another word, such as join, to avoid conflicts with traits.
        use (Identity, About);

        public function identity() : Identity
        {
            return new Identity($record->key());
        }

        ...
    }

    // Client
    $person = new PersonFromStore($fetchedPerson) use (PersonID, AboutMe);
    // Test
    $person = new PersonFromStore($fetchedPerson) use (TestPersonID, AboutMe);
```

Now, we can create objects from their interfaces and thus, we have no more hard-coded dependencies in the methods.

###  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

Maturity62

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

Total

5

Last Release

3562d ago

Major Versions

0.3.0 → 1.0.0-alpha2016-04-10

### Community

Maintainers

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

---

Top Contributors

[![ixmanuel](https://avatars.githubusercontent.com/u/5464741?v=4)](https://github.com/ixmanuel "ixmanuel (45 commits)")

---

Tags

dependency-injectiondependenciesIxinversion controlfactory method

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ixmanuel-nexus/health.svg)

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

###  Alternatives

[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k130.5M1.4k](/packages/pimple-pimple)[php-di/php-di

The dependency injection container for humans

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

Generic and extensible callable invoker

26857.8M56](/packages/php-di-invoker)[laminas/laminas-servicemanager

Factory-Driven Dependency Injection Container

15955.1M694](/packages/laminas-laminas-servicemanager)

PHPackages © 2026

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