{"id":14987332,"url":"https://github.com/xxperez/codeigniter4modular","last_synced_at":"2025-04-12T00:02:32.406Z","repository":{"id":43167314,"uuid":"301336341","full_name":"XXPerez/Codeigniter4Modular","owner":"XXPerez","description":"Modular structure examples for Codeigniter4","archived":false,"fork":false,"pushed_at":"2023-05-08T01:24:38.000Z","size":3043,"stargazers_count":41,"open_issues_count":4,"forks_count":19,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T00:02:12.922Z","etag":null,"topics":["codeigniter4","php"],"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/XXPerez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","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":"2020-10-05T08:09:32.000Z","updated_at":"2025-03-01T03:56:25.000Z","dependencies_parsed_at":"2024-09-25T00:32:19.995Z","dependency_job_id":null,"html_url":"https://github.com/XXPerez/Codeigniter4Modular","commit_stats":{"total_commits":65,"total_committers":2,"mean_commits":32.5,"dds":"0.27692307692307694","last_synced_commit":"bd8cc44767b321bcccc9996cf3e244e0ca1af65a"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XXPerez%2FCodeigniter4Modular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XXPerez%2FCodeigniter4Modular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XXPerez%2FCodeigniter4Modular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XXPerez%2FCodeigniter4Modular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XXPerez","download_url":"https://codeload.github.com/XXPerez/Codeigniter4Modular/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248497802,"owners_count":21113984,"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","php"],"created_at":"2024-09-24T14:14:27.759Z","updated_at":"2025-04-12T00:02:32.346Z","avatar_url":"https://github.com/XXPerez.png","language":"PHP","readme":"# CodeIgniter 4 Modular Structure Application Starter\n\n## What is CodeIgniter Modular ?\n\nCodeIgniter is a PHP full-stack web framework that is light, fast, flexible, and secure. \nMore information can be found at the [official site](http://codeigniter.com).\n\nThe \"Modular Structure\" allows to separate each module from other, having each one, controllers, database, filters, libraries, languages, models, routes, validations and views.   \n\n| Modules | Module | Structure |\n| ------- | ------ | --------- | \n| Modules/ | Home/ | Config | \n|  |  | Controllers | \n|  |  | Language | \n|  |  | Views | \n|  |  |  | \n| Modules/ | Users/ | Config | \n|  |  | Controllers | \n|  |  | Database | \n|  |  | Filters | \n|  |  | Language | \n|  |  | Libraries | \n|  |  | Models | \n|  |  | Validation | \n|  |  | Views | \n|  |  |  | \n| Modules/ | Utils/ | Config | \n|  |  | Controllers | \n|  |  | Language | \n|  |  | Libraries | \n\nThis repository holds a composer-installable app starter, with jQuery, Bootstrap4, and Login/Register fully working module examples\nIt has been built from the \n[development repository](https://github.com/codeigniter4/CodeIgniter4).\n\nMore information about the plans for version 4 can be found in [the announcement](http://forum.codeigniter.com/thread-62615.html) on the forums.\n\nThe user guide corresponding to this version of the framework can be found\n[here](https://codeigniter4.github.io/userguide/). \n\n## Installation \u0026 updates\n\nGo to a browsable directory (Example: c:\\xampp\\htdocs)\n\n```sh\ncomposer create-project xxperez/codeigniter4modular\n```\nthen \n```sh\ncd codeigniter4modular\n``` \n\n## Updates \nWhenever there is a new release of the framework:\n```sh\ncomposer update\n``` \n\nWhen updating, check the release notes to see if there are any changes you might need to apply\nto your `app` folder. The affected files can be copied or merged from\n`vendor/codeigniter4/framework/app`.\n\n## Setup\n\nGo to Codeigniter4Modular directory.\n```sh\ncd codeigniter4modular\n``` \n\nCopy `env` to `.env`: \n```sh\ncopy env .env\n``` \n\nEdit .env, and tailor for your app, specifically the baseURL\nand default database settings:\n```sh\napp.baseURL = 'http://localhost/codeigniter4modular/public'\n\ndatabase.default.hostname = localhost\ndatabase.default.database = database\ndatabase.default.username = username\ndatabase.default.password = password\ndatabase.default.DBDriver = MySQLi\ndatabase.default.port = 3306\n```\n\nAfter database configuration, run migrate to ensure the table users are created:\n```sh\nphp spark migrate -all\n```\n\n## Modular configuration\nAdd this lines to your .env, and adapt as necessary. The example files have english and spanish translations:\n\n```php\n#--------------------------------------------------------------------\n# LANGUAGE\n#--------------------------------------------------------------------\napp.defaultLocale = 'en'\napp.supportedLocales = ['en','es','fr','de']\napp.negotiateLocale = true\napp.appTimezone = 'America/Chicago'\n```\n\nNow, you can test the app, browse your installed directory, click on \"Login\" in the main page. \n\nhttp://localhost/codeigniter4modular\n\n\n### More about modular configuration\nAll modules will reside under /Modules, but can be allocated elsewhere. \nWhen your create a module, edit /app/Config/Autoload.php and add your module to the PSR4, to be able to be found.\n```php\n\tpublic $psr4 = [\n            APP_NAMESPACE =\u003e APPPATH, // For custom app namespace\n            'Config'      =\u003e APPPATH . 'Config',\n            APP_NAMESPACE.'\\Controllers' =\u003e APPPATH.'Controllers',\n            'Dashboard' =\u003e APPPATH . '../Modules\\Dashboard' ,\n            'Users' =\u003e APPPATH . '../Modules\\Users' ,\n\t];\n```\n\nEach filter you declare inside a module, must to be aliased in app/Config/Filters.php to be able to be used inside a rule.\n```php\n\tpublic $aliases = [\n\t\t'csrf'     =\u003e \\CodeIgniter\\Filters\\CSRF::class,\n\t\t'toolbar'  =\u003e \\CodeIgniter\\Filters\\DebugToolbar::class,\n\t\t'honeypot' =\u003e \\CodeIgniter\\Filters\\Honeypot::class,\n\t\t'auth' =\u003e \\Users\\Filters\\AuthFilter::class,\n\t\t'noauth' =\u003e \\Users\\Filters\\NoAuthFilter::class,\n\t];\n```\nEach validation you declare inside a module, must to be set in the ruleSets variable in app/Config/Validation.php.\n```php\n\tpublic $ruleSets = [\n\t\t\\CodeIgniter\\Validation\\Rules::class,\n\t\t\\CodeIgniter\\Validation\\FormatRules::class,\n\t\t\\CodeIgniter\\Validation\\FileRules::class,\n\t\t\\CodeIgniter\\Validation\\CreditCardRules::class,\n\t\t\\Users\\Validation\\UserRules::class,\n\t];\n```\n\n### Modular libraries\nLibraries within a module are used to define functions that lightweight the controllers.\nIf you prefer to use validations inside a module library, you will need to access requests and validation objects directly:\n```php\n        $request = \\Config\\Services::request();\n        $validation = \\Config\\Services::validation();\n        $validation-\u003esetRules($rules, $errors);\n        $validation-\u003ewithRequest($request)-\u003erun();\n        $validationErrors = $validation-\u003egetErrors();\n```\n\n### Modular creation\nTo create new modules, you can use spark module:create option, from base directory.\nFor example, to create a module named 'Customers':\n```sh\nphp spark module:create Customers\n``` \n\nModule create options:\n-f ModuleDir (other than App/Modules)\n-c FCLMVO    (Create only con[F]ig, [C]ontroller, [L]ibrary, [M]odel, [V]iew, [O]ther dirs)\n\n```sh\nphp spark module:create Customers -c FCMV\n``` \n\n## Important Change with index.php\n\n`index.php` is no longer in the root of the project! It has been moved inside the *public* folder,\nfor better security and separation of components.\n\nThis means that you should configure your web server to \"point\" to your project's *public* folder, and\nnot to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the\nframework are exposed.\n\n**Please** read the user guide for a better explanation of how CI4 works!\nThe user guide updating and deployment is a bit awkward at the moment, but we are working on it!\n\n## Repository Management\n\nWe use Github issues, in our main repository, to track **BUGS** and to track approved **DEVELOPMENT** work packages.\nWe use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss\nFEATURE REQUESTS.\n\nThis repository is a \"distribution\" one, built by our release preparation script. \nProblems with it can be raised on our forum, or as issues in the main repository.\n\n## Server Requirements\n\nPHP version 7.2 or higher is required, with the following extensions installed: \n\n- [intl](http://php.net/manual/en/intl.requirements.php)\n- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\\CURLRequest library\n\nAdditionally, make sure that the following extensions are enabled in your PHP:\n\n- json (enabled by default - don't turn it off)\n- [mbstring](http://php.net/manual/en/mbstring.installation.php)\n- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php)\n- xml (enabled by default - don't turn it off)\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxxperez%2Fcodeigniter4modular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxxperez%2Fcodeigniter4modular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxxperez%2Fcodeigniter4modular/lists"}