PHPackages                             mjamilasfihani/conquer-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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. mjamilasfihani/conquer-container

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

mjamilasfihani/conquer-container
================================

Containerized Dependency Injection for CodeIgniter 4 Controller.

v2.2.5(3y ago)2108[1 PRs](https://github.com/mjamilasfihani/conquer-container/pulls)PHPPHP ^7.4 || ^8.0 || ^8.1

Since Jan 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mjamilasfihani/conquer-container)[ Packagist](https://packagist.org/packages/mjamilasfihani/conquer-container)[ Docs](https://github.com/mjamilasfihani/conquer-container)[ RSS](/packages/mjamilasfihani-conquer-container/feed)WikiDiscussions develop Synced today

READMEChangelog (9)Dependencies (3)Versions (11)Used By (0)

CodeIgniter 4 Container
=======================

[](#codeigniter-4-container)

Containerized Dependency Injection for CodeIgniter 4 Controller.

Warning! This library crack the core point of CodeIgniter 4, consider to use it at your own risk!

[![](https://github.com/mjamilasfihani/conquer-container/workflows/PHPUnit/badge.svg)](https://github.com/mjamilasfihani/conquer-container/actions/workflows/phpunit.yml)[![](https://github.com/mjamilasfihani/conquer-container/workflows/PHPStan/badge.svg)](https://github.com/mjamilasfihani/conquer-container/actions/workflows/phpstan.yml)[![](https://github.com/mjamilasfihani/conquer-container/workflows/Deptrac/badge.svg)](https://github.com/mjamilasfihani/conquer-container/actions/workflows/deptrac.yml)[![Coverage Status](https://camo.githubusercontent.com/cb00c72b9d8ee407d33e5a5974dfec37423ad915e2bef95a436454c52e49cc15/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d6a616d696c6173666968616e692f636f6e717565722d636f6e7461696e65722f62616467652e7376673f6272616e63683d646576656c6f70)](https://coveralls.io/github/mjamilasfihani/conquer-container?branch=develop)

Prerequisites
-------------

[](#prerequisites)

Usage of Conquer\\Container requires the following:

- A [CodeIgniter 4.2.0+](https://github.com/codeigniter4/CodeIgniter4/) based project
- [Composer](https://getcomposer.org/) for package management
- PHP 7.4+

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

[](#installation)

Use the package manager [composer](https://getcomposer.org/) to install.

```
composer require mjamilasfihani/conquer-container
```

Usage
-----

[](#usage)

Let's say you have `app/Libraries/ExampleLibrary.php` file, and you want to load in `__construct()` function

in your controller without initializing it manually. Than this library is yours.

Can I imagine your controller? Thank you :

```
namespace App\Controllers;

use App\Controllers\BaseController;
use App\Libraries\ExampleLibrary;

class Home extends BaseController
{
    /**
     * @var \App\Libraries\ExampleLibrary
     */
    protected ExampleLibrary $exampleLibrary;

    // This is your old constructor isn't?
    //
    // /**
    //  * Constructor
    //  */
    // public function __construct()
    // {
    //     $this->exampleLibrary = new ExampleLibrary();
    // }

    /**
     * This will be your new Constructor
     *
     * @param \App\Libraries\ExampleLibrary $exampleLibrary
     */
    public function __construct(ExampleLibrary $exampleLibrary)
    {
        $this->exampleLibrary = $exampleLibrary;
    };

    /**
     * Display Homepage
     *
     * @return string
     */
    public function index(): string
    {
        // even it has equal result, depend how like you call your library :)
        $this->exampleLibrary;

        return view('welcome_message');
    }
}
```

If you have `AnotherExampleLibrary.php` and it need `ExampleLibrary` class in the constructor,

feel free to add it. Because it has been supported in since v2.0.0

Here is what I mean :

```
namespace App\Libraries;

use App\Libraries\ExampleLibrary;

class AnotherExampleLibrary
{
    protected ExampleLibrary $exampleLibrary;

    /**
     * Constructor
     *
     * @param \App\Libraries\ExampleLibrary $exampleLibrary
     */
    public function __construct(ExampleLibrary $exampleLibrary)
    {
        $this->exampleLibrary = $exampleLibrary;
    }

    public function anotherExampleMethod()
    {
        // you have a power from your parent class
        $exampleLibrary = $this->exampleLibrary;

        ...
    }
}
```

Now you can call it with no worries from your controller :

```
public function __construct(AnotherExampleLibrary $anotherExampleLibrary)
{
    // this use case is very help full for implement the repository pattern
    $this->anotherExampleLibrary = $anotherExampleLibrary;
}
```

Notes
-----

[](#notes)

Remember one thing! Doing container like this is not officially supported by CodeIgniter 4,

since it has different structure do not judge me if you got an error for calling

the CodeIgniter 4 library use this method. (Do It By Your Own Risk)

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

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 82% 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 ~4 days

Total

9

Last Release

1224d ago

Major Versions

v1.0.1 → v2.0.02023-01-24

PHP version history (2 changes)v1.0.0PHP ^7.4 || ^8.0

v2.2.4PHP ^7.4 || ^8.0 || ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/51300528?v=4)[Mohammad Jamil Asfihani](/maintainers/mjamilasfihani)[@mjamilasfihani](https://github.com/mjamilasfihani)

---

Top Contributors

[![mjamilasfihani](https://avatars.githubusercontent.com/u/51300528?v=4)](https://github.com/mjamilasfihani "mjamilasfihani (41 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")

---

Tags

codeignitercontainercontrollerinjectioncontainerinjectioncodeignitercontroller

###  Code Quality

Static AnalysisRector

### Embed Badge

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

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

###  Alternatives

[league/container

A fast and intuitive dependency injection container.

86894.4M437](/packages/league-container)[slince/di

A flexible dependency injection container

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

A PSR-11 compliant autowiring dependency injection container.

2860.1k2](/packages/capsule-di)[miladrahimi/phpcontainer

Dependency injection (IoC) container for PHP projects

1324.1k2](/packages/miladrahimi-phpcontainer)

PHPackages © 2026

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