{"id":15470497,"url":"https://github.com/mjamilasfihani/conquer-container","last_synced_at":"2025-12-13T04:30:03.543Z","repository":{"id":65453708,"uuid":"592641507","full_name":"mjamilasfihani/conquer-container","owner":"mjamilasfihani","description":"Containerized Dependency Injection for CodeIgniter 4 Controller.","archived":false,"fork":false,"pushed_at":"2023-06-29T23:07:05.000Z","size":57,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-08-30T14:53:01.360Z","etag":null,"topics":["codeigniter","container","controller","injection"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjamilasfihani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"mjamilasfihani"}},"created_at":"2023-01-24T07:35:51.000Z","updated_at":"2025-03-11T12:59:59.000Z","dependencies_parsed_at":"2025-05-26T17:00:13.924Z","dependency_job_id":null,"html_url":"https://github.com/mjamilasfihani/conquer-container","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/mjamilasfihani/conquer-container","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjamilasfihani%2Fconquer-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjamilasfihani%2Fconquer-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjamilasfihani%2Fconquer-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjamilasfihani%2Fconquer-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjamilasfihani","download_url":"https://codeload.github.com/mjamilasfihani/conquer-container/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjamilasfihani%2Fconquer-container/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27699845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-13T02:00:09.769Z","response_time":147,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeigniter","container","controller","injection"],"created_at":"2024-10-02T02:05:07.169Z","updated_at":"2025-12-13T04:30:03.505Z","avatar_url":"https://github.com/mjamilasfihani.png","language":"PHP","funding_links":["https://github.com/sponsors/mjamilasfihani"],"categories":[],"sub_categories":[],"readme":"# CodeIgniter 4 Container\nContainerized Dependency Injection for CodeIgniter 4 Controller.\n\nWarning! This library crack the core point of CodeIgniter 4, consider to use it at your own risk!\n\n[![](https://github.com/mjamilasfihani/conquer-container/workflows/PHPUnit/badge.svg)](https://github.com/mjamilasfihani/conquer-container/actions/workflows/phpunit.yml)\n[![](https://github.com/mjamilasfihani/conquer-container/workflows/PHPStan/badge.svg)](https://github.com/mjamilasfihani/conquer-container/actions/workflows/phpstan.yml)\n[![](https://github.com/mjamilasfihani/conquer-container/workflows/Deptrac/badge.svg)](https://github.com/mjamilasfihani/conquer-container/actions/workflows/deptrac.yml)\n[![Coverage Status](https://coveralls.io/repos/github/mjamilasfihani/conquer-container/badge.svg?branch=develop)](https://coveralls.io/github/mjamilasfihani/conquer-container?branch=develop)\n\n## Prerequisites\nUsage of Conquer\\Container requires the following:\n\n- A [CodeIgniter 4.2.0+](https://github.com/codeigniter4/CodeIgniter4/) based project\n- [Composer](https://getcomposer.org/) for package management\n- PHP 7.4+\n\n## Installation\nUse the package manager [composer](https://getcomposer.org/) to install.\n\n```bash\ncomposer require mjamilasfihani/conquer-container\n```\n\n## Usage\nLet's say you have `app/Libraries/ExampleLibrary.php` file, and you want to load in `__construct()` function\n\nin your controller without initializing it manually. Than this library is yours.\n\nCan I imagine your controller? Thank you :\n\n```php\nnamespace App\\Controllers;\n\nuse App\\Controllers\\BaseController;\nuse App\\Libraries\\ExampleLibrary;\n\nclass Home extends BaseController\n{\n    /**\n     * @var \\App\\Libraries\\ExampleLibrary\n     */\n    protected ExampleLibrary $exampleLibrary;\n\n    // This is your old constructor isn't?\n    //\n    // /**\n    //  * Constructor\n    //  */\n    // public function __construct()\n    // {\n    //     $this-\u003eexampleLibrary = new ExampleLibrary();\n    // }\n\n    /**\n     * This will be your new Constructor\n     *\n     * @param \\App\\Libraries\\ExampleLibrary $exampleLibrary\n     */\n    public function __construct(ExampleLibrary $exampleLibrary)\n    {\n        $this-\u003eexampleLibrary = $exampleLibrary;\n    };\n    \n    /**\n     * Display Homepage\n     *\n     * @return string\n     */\n    public function index(): string\n    {\n        // even it has equal result, depend how like you call your library :)\n        $this-\u003eexampleLibrary;\n\n        return view('welcome_message');\n    }\n}\n```\n\nIf you have `AnotherExampleLibrary.php` and it need `ExampleLibrary` class in the constructor,\n\nfeel free to add it. Because it has been supported in since v2.0.0\n\nHere is what I mean :\n\n```php\nnamespace App\\Libraries;\n\nuse App\\Libraries\\ExampleLibrary;\n\nclass AnotherExampleLibrary\n{\n    protected ExampleLibrary $exampleLibrary;\n\n    /**\n     * Constructor\n     *\n     * @param \\App\\Libraries\\ExampleLibrary $exampleLibrary\n     */\n    public function __construct(ExampleLibrary $exampleLibrary)\n    {\n        $this-\u003eexampleLibrary = $exampleLibrary;\n    }\n\n    public function anotherExampleMethod()\n    {\n        // you have a power from your parent class\n        $exampleLibrary = $this-\u003eexampleLibrary;\n\n        ...\n    }\n}\n```\n\nNow you can call it with no worries from your controller :\n\n```php\npublic function __construct(AnotherExampleLibrary $anotherExampleLibrary)\n{\n    // this use case is very help full for implement the repository pattern\n    $this-\u003eanotherExampleLibrary = $anotherExampleLibrary;\n}\n```\n\n## Notes\nRemember one thing! Doing container like this is not officially supported by CodeIgniter 4,\n\nsince it has different structure do not judge me if you got an error for calling\n\nthe CodeIgniter 4 library use this method. (Do It By Your Own Risk)\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjamilasfihani%2Fconquer-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjamilasfihani%2Fconquer-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjamilasfihani%2Fconquer-container/lists"}