{"id":14987377,"url":"https://github.com/simpletine/codeigniter-4-hmvc","last_synced_at":"2026-02-28T07:05:02.552Z","repository":{"id":37784563,"uuid":"503141278","full_name":"Simpletine/CodeIgniter-4-HMVC","owner":"Simpletine","description":"Implementing HMVC with CodeIgniter 4: In this approach, we group the Model-View-Controller components into packages called Modules, each acting as a self-contained unit of the application.","archived":false,"fork":false,"pushed_at":"2024-07-11T04:05:12.000Z","size":1450,"stargazers_count":12,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-04T12:03:43.278Z","etag":null,"topics":["codeigniter4","hmvc-architecture","php","simpletine"],"latest_commit_sha":null,"homepage":"https://github.com/Simpletine/CodeIgniter4-HMVC","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/Simpletine.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-13T23:08:57.000Z","updated_at":"2024-11-05T03:40:47.000Z","dependencies_parsed_at":"2024-09-25T00:32:14.944Z","dependency_job_id":null,"html_url":"https://github.com/Simpletine/CodeIgniter-4-HMVC","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.25,"last_synced_commit":"d7ff541d63c0ac1bc305c306cb5524f413633b13"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simpletine%2FCodeIgniter-4-HMVC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simpletine%2FCodeIgniter-4-HMVC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simpletine%2FCodeIgniter-4-HMVC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simpletine%2FCodeIgniter-4-HMVC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Simpletine","download_url":"https://codeload.github.com/Simpletine/CodeIgniter-4-HMVC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239820237,"owners_count":19702524,"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","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":["codeigniter4","hmvc-architecture","php","simpletine"],"created_at":"2024-09-24T14:14:31.711Z","updated_at":"2026-02-28T07:05:02.512Z","avatar_url":"https://github.com/Simpletine.png","language":"PHP","readme":"# Codeigniter 4 HMVC \n\n[![Official Website](https://img.shields.io/badge/Official_Website-Visit-yellow)](https://simpletine.com)  \n[![YouTube Channel](https://img.shields.io/badge/YouTube_Channel-Subscribe-FF0000)](https://www.youtube.com/channel/UCRuDf31rPyyC2PUbsMG0vZw) \n \n### Prerequisites\n1. PHP 7.4 or above\n2. Composer required\n2. CodeIgniter 4.4.8\n\n### Installation Guide\n\nClone project to your project root folder\n```bash\ncomposer create-project simpletine/codeigniter4-hmvc ci4_hmvc --stability=dev\n```\nOr\n```bash\ngit clone https://github.com/Simpletine/CodeIgniter4-HMVC.git ci4_hmvc\n```\nThen\n```bash\ncd ci4_hmvc\n``` \n\nCopy some require file to root folder (Upgrading to v4.4.8)\n```bash\ncomposer update\ncp vendor/codeigniter4/framework/public/index.php public/index.php\ncp vendor/codeigniter4/framework/spark spark\n```\n\nCopy `env` file\n```bash\ncp env .env\n```\n\nRun the app, using different port, add options `--port=9000`\n```bash\nphp spark serve\n```\n\n\n---\n## Module Commands\n```bash\nphp spark make:module [module] \n```\n\n### Example\nCreate a blog module\n```bash\nphp spark make:module blogs\n```\n\n###  Result Directory\n    App \n    ├── Config       \n    │   └── Routes.php (Added group called blogs)\n    ├── Modules      \n    │   └── Blogs\n    │       ├──  Controllers\n    │           └──  Blogs.php\n    │       ├──  Models\n    │           └──  BlogsModel.php\n    │       └──  Views\n    │           └──  index.php\n    └── ...  \n\n### Route Group\nAfter generate `Blogs` Module, add a route group for the module at `App\\Config\\Routes.php`\n```php\n$routes-\u003egroup(\n    'blogs', ['namespace' =\u003e '\\Modules\\Blogs\\Controllers'], function ($routes) {\n        $routes-\u003eget('/', 'Blogs::index');\n    }\n);\n```\n\n## PSR4\nAt `App/Config/Autoload.php`, you can configure your custom namespace:\n```php\npublic $psr4 = [\n    // Sample\n    \"$module\" =\u003e APPPATH . \"$module\",\n\n    // Base on Example above\n    \"Blogs\" =\u003e APPPATH . \"Modules/Blogs\", // Example \n    // ...\n];\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpletine%2Fcodeigniter-4-hmvc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimpletine%2Fcodeigniter-4-hmvc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpletine%2Fcodeigniter-4-hmvc/lists"}