PHPackages                             gidato/laravel-container-extensions - 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. gidato/laravel-container-extensions

ActiveLibrary

gidato/laravel-container-extensions
===================================

Extensions for Laravels Container and App

v0.1.0(6y ago)016[1 PRs](https://github.com/gidato/laravel-container-extensions/pulls)MITPHP

Since Jan 30Pushed 5y ago1 watchersCompare

[ Source](https://github.com/gidato/laravel-container-extensions)[ Packagist](https://packagist.org/packages/gidato/laravel-container-extensions)[ RSS](/packages/gidato-laravel-container-extensions/feed)WikiDiscussions master Synced yesterday

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

Gidato / Laravel-Container-Extensions
=====================================

[](#gidato--laravel-container-extensions)

```

composer require gidato/laravel-container-extensions

```

You then need to find the following line in \\bootstrap\\app.php

```
$app = new Illuminate\Foundation\Application(
    $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);

```

And change it as follows:

```
$app = new Gidato\Container\Application(
    $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);

```

#### Nested Containers

[](#nested-containers)

A separate container can be created and used within a container, effectively namespacing the bound elements.

This allows specific parts of the application to be directly associated with a specific container.

To access sub containers, you can use `app()->container("name-of-container")`, and then bind things to this level.

Directly bound classes can then be retrieved (if you want them all), using `$container->getAllBound()`. This will give only specifically bound classes/objects, and will not deliver any that could be dynamically created.

If you want to exclude other nested containers from this call, use `$container->getAllBound($recursive = true)`

#### Binding using Factory Creation

[](#binding-using-factory-creation)

Instead of creating a closure in the Provider, this allows the creation to be done within a factory class, which can then live with the class, making it more accessible.

The factory must implement `Gidato\Container\Contract\FactoryContract` which requires that the class be invokable. The method should be defined to match the following:

```
public function __invoke(\Psr\Container\ContainerInterface $container, string $requestedName, array $parameters = []);

```

And then, in the provider, class can be bound using:

```
$app->singletonFromFactory($abstract, $factoryClass)
$app->bindFromFactory($abstract, $factoryClass, $shared = false)

```

License
-------

[](#license)

This software is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Total

4

Last Release

2261d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c5dc6acc412b19ac41e2c8050e22a822c5fe1a08818ca2b7de097cdba628465?d=identicon)[gidato](/maintainers/gidato)

---

Top Contributors

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

---

Tags

laravelfactorycontainersgidato

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gidato-laravel-container-extensions/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[coderello/laravel-populated-factory

An easy way to generate populated factories.

24523.0k](/packages/coderello-laravel-populated-factory)

PHPackages © 2026

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