PHPackages                             dikki/ci4-di - 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. dikki/ci4-di

ActiveLibrary[Framework](/categories/framework)

dikki/ci4-di
============

Implement and Use Dependency Injection in CodeIgniter 4.

0.0.2(3mo ago)16[1 issues](https://github.com/namankumar80510/ci4-di/issues)MITPHPPHP &gt;=8.1

Since Jan 10Pushed 3mo agoCompare

[ Source](https://github.com/namankumar80510/ci4-di)[ Packagist](https://packagist.org/packages/dikki/ci4-di)[ RSS](/packages/dikki-ci4-di/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

CI4 DI
======

[](#ci4-di)

Robust Dependency Injection for CodeIgniter 4, powered by [League Container](https://container.thephpleague.com/).

Features
--------

[](#features)

- **PSR-11 Compliant** Container.
- **Autowiring**: Automatically resolve dependencies for classes without manual configuration.
- **Service Providers**: Organize service registrations.
- **Aliases**: Bind services to aliases.
- **Shared Services**: Support for Singleton pattern.
- **Seamless Integration**: Replaces CI4's Controller constructor injection mechanism.

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

[](#installation)

```
composer require dikki/ci4-di
```

Initialize the configuration:

```
php spark container:publish
```

This will create `app/Config/Container.php` where you can configure services.

Setup
-----

[](#setup)

Modify `app/Config/Services.php` to define the `codeigniter` service override. This ensures the application uses the DI Container for Controller instantiation.

```
