Download the PHP package mjamilasfihani/conquer-container without Composer
On this page you can find all versions of the php package mjamilasfihani/conquer-container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mjamilasfihani/conquer-container
More information about mjamilasfihani/conquer-container
Files in mjamilasfihani/conquer-container
Package conquer-container
Short Description Containerized Dependency Injection for CodeIgniter 4 Controller.
License
Homepage https://github.com/mjamilasfihani/conquer-container
Informations about the package conquer-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!
Prerequisites
Usage of Conquer\Container requires the following:
- A CodeIgniter 4.2.0+ based project
- Composer for package management
- PHP 7.4+
Installation
Use the package manager composer to install.
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 :
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 :
Now you can call it with no worries from your controller :
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
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.