{"id":26052495,"url":"https://github.com/oniseven/ci4-adminlte","last_synced_at":"2026-05-02T20:38:16.645Z","repository":{"id":281108051,"uuid":"943724529","full_name":"oniseven/CI4-AdminLTE","owner":"oniseven","description":"Codeigniter 4 with AdminLTE template","archived":false,"fork":false,"pushed_at":"2025-03-07T02:35:16.000Z","size":2872,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-07T03:22:09.017Z","etag":null,"topics":["adminlte3","codeigniter","codeigniter4","codeigniter4-adminlte","php","php-fram","php8"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/oniseven.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2025-03-06T06:56:19.000Z","updated_at":"2025-03-07T02:35:19.000Z","dependencies_parsed_at":"2025-03-07T03:32:12.267Z","dependency_job_id":null,"html_url":"https://github.com/oniseven/CI4-AdminLTE","commit_stats":null,"previous_names":["oniseven/ci4-adminlte"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oniseven%2FCI4-AdminLTE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oniseven%2FCI4-AdminLTE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oniseven%2FCI4-AdminLTE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oniseven%2FCI4-AdminLTE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oniseven","download_url":"https://codeload.github.com/oniseven/CI4-AdminLTE/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242512389,"owners_count":20141389,"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":["adminlte3","codeigniter","codeigniter4","codeigniter4-adminlte","php","php-fram","php8"],"created_at":"2025-03-08T06:34:25.237Z","updated_at":"2026-05-02T20:38:11.625Z","avatar_url":"https://github.com/oniseven.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodeIgniter 4 (4.6.0) + AdminLTE (3.2.0)\n\n## Server Requirements (default codeigniter 4 requirements)\n\nPHP version 8.1 or higher is required, with the following extensions installed:\n\n- [intl](http://php.net/manual/en/intl.requirements.php)\n- [mbstring](http://php.net/manual/en/mbstring.installation.php)\n\n\u003e [!WARNING]\n\u003e - The end of life date for PHP 7.4 was November 28, 2022.\n\u003e - The end of life date for PHP 8.0 was November 26, 2023.\n\u003e - If you are still using PHP 7.4 or 8.0, you should upgrade immediately.\n\u003e - The end of life date for PHP 8.1 will be December 31, 2025.\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- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL\n- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\\CURLRequest library\n\n## Setup\n\nCopy `env` to `.env` and tailor for your app, specifically the baseURL\nand any database settings.\n\n## Installation\ncreate database using spark or other tools\n\n```cli\nphp spark db:create your_database\n```\n\nrun database setup command, \nthis part will run migration and seeders\nto create the tables and adding some dummy data\n\n```cli\nphp spark setup:datatabse\n```\n\n## Template Library Usage\n\nUsing database in mandatory, because I use model to populate the menu, so make sure you already done the installation section.\n\n### Details\n- Locations: `app/Libraries`\n- File name: `Template.php`\n\n### Page type\n\nAccording to AdminLTE, in my opinion, there are 2 type of page. \n1. Full page that contain header, menus, sidebar, footer, and other. for example Dashboard\n2. Blank page which is didn't have any menus, sidebar, or else. for example Login and Registration page\n\nThat is why there are 2 template view in this repo,\n1. `Default` view, which you can find in `Views/template/` as `default.php`\n2. `Blank` view, which you can find in `Views/template/` as `blank.php`\n\nThe partial of each view are located in the same folder with `default` and `blank` as a folder name. I know this is not a best practice in naming partial but hey, you can change it if you want.\n\nExample to create a view, either its default or blank one\n\n```html\n\u003c?= $this-\u003eextend('template/default') ?\u003e\n\u003c!-- Use template/blank if you want to use blank template --\u003e\n\n\u003c?= $this-\u003esection('content') ?\u003e\n\n\u003c!-- Put your main content in here --\u003e\n\n\u003c?= $this-\u003eendSection('content') ?\u003e\n```\n\n----\n\n### Render the template\n- Method: `render()`\n\nThis method has 2 parameter,\n- `$view` (* mandatory): Its your view page file so its mandatory otherwise error will occurred\n- `$data`: Data for your page\n\n```php\nnamespace App\\Controllers;\n\nuse App\\Libraries\\Template;\n\nclass Home extends BaseController\n{\n  public function index()\n  {\n    $template = new Template();\n\n    return $template-\u003erender('starter_page');\n\n    // or render it with data\n    return $template-\u003erender('startes_page', [\n      'curdate' =\u003e date('d-m-Y')\n    ]);\n  }\n}\n```\n\n----\n\n### Set Page Title\n- Method: `page_title()`\n\nI bet you dont need an explanation for this method right? come on.. its a freaking page title man, what else should I explain.\n\n```php\n$template-\u003epage_title('Welcome Page');\n```\n\n----\n\n### Add Custom Page CSS\n- Method: `page_css()`\n\nif you have a custom css for a specific page, you can load it by using this method.\n\n```php\n$template-\u003epage_css(\"assets/dist/css/custom_page.css);\n```\n\nyou could also set the parameter as an array if you have multiple custom css for one page.\n\n```php\n$template-\u003epage_css([\n  \"assets/dist/css/demo1.css\", \n  \"assets/dist/css/demo2.css\"\n]);\n```\n\n----\n\n### Add Custom Page JS\n- Method: `page_js()`\n\nif you have a custom js file for a specific page, you can load it by using this method.\n\n```php\n$template-\u003epage_js(\"assets/dist/js/custom_page.css);\n```\n\nyou could also set the parameter as an array if you have multiple custom js for one page.\n\n```php\n$template-\u003epage_js([\n  \"assets/dist/js/demo1.css\", \n  \"assets/dist/js/demo2.css\"\n]);\n```\n\n----\n\n### Plugins\n- Method: `plugins()`\n\nFirst things first, there are new file in `app\\Config` named as `Plugins.php`. (yeah, dont ask me why I name it `Plugins` LOL)\nIts contain list of javascript/jquery library that consist of `css` and `js` property. \nThere are so many 3rd parties libraries that been use in AdminLTE, I only list some of them that I use in this project.\nFeel free to edit it according to you need in you project. Just dont expect me to list all of them for you, ok.\n\nThe usage of this method is pretty simple. It only has 1 parameter, it can be string or an array, just in case you need more than one library in one page, which is most likely happen all the time (Duhh). All you have to do just put the property name that you made in `Plugins.php` file.\n\n```php\n$template-\u003eplugins('datatables');\n// or\n$template-\u003eplugins(['datatable', 'select2']);\n```\n\n----\n\n### Hiding Content Toolbar, Hiding Breadcrums, Hiding Footer, Hiding things\n- Method: `hide_content_toolbar()`, `hide_breadcrums()`, `hide_footer()`, `hide()`\n\nYes, you read it right, you can hide stuff in here. Magic? No it is not, wake up already.\nI do believe there should be a better way to do this, but I haven't found it yet.\n\n```php\n$template\n  -\u003ehide_content_toolbar()\n  -\u003ehide_breadcrums()\n  -\u003ehide_footer();\n\n$template-\u003ehide([\n  'content-toolbar',\n  'breadcrums',\n  'footer'\n]);\n```\n\n----\n\n### Set Custom Class\n\nThis methode is use if you want to add a custom or additional class to some specific tags. Access the tag classes data in view by calling `$classes` variable. For now its only accepting `body` tag.\n\n```php\n$template-\u003etag_class(\"body\", \"hold-transition login-page\");\n```\n\n----\n\n### Examples\n\n```php\n$template-\u003epage_title('Welcome');\n$template-\u003eplugins('datatables');\n$template-\u003epage_js('assets/dist/js/pages/demo.js');\n$template-\u003erender('welcome');\n\n// or\n$data = []; // set your data\n$template\n  -\u003epage_title(\"Welcome\")\n  -\u003eplugins(['datatables'])\n  -\u003epage_js(\"assets/dist/js/pages/demo.js\")\n  -\u003erender('welcome', $data);\n\n// or\n$template\n  -\u003epage_title('Login page')\n  -\u003etag_class('body', 'hold-transition login-page')\n  -\u003erender('login');\n```\n\n----\n\n## Datatables Library Usage\n\nDatatable library is a simple library that I create to generate data for datatables. This library only work with simple task or query, but not gonna work with really complex task or query.\nYou can use `loadQuery()` method, to get the data using `sql query`, but you have to set your own filter and stuff.\n\n### Library Usage\n\n```php\n$dt = new \\App\\Libraries\\Datatables(service('request'));\n// note: `service(request)` is mandatory\n```\n\n----\n\n## Return data format\n\nThe return data format of this library will be an array like this\n\n```php\n$response = [\n  \"recordsTotal\" =\u003e 1000,\n  \"recordsFiltered\" =\u003e 500,\n  \"data\" =\u003e $data,\n];\n```\n\n----\n\n### Set Up Database Group\n- Method: `dbgroup()`\n\nIf you need to access the table in different group, you can use this method to set the database configs group.\n\n```php\n$dt-\u003edbGroup('db_group2');\n```\n\n----\n\n### Set Columns\n- Method: `select($column, $escape)`\n\nUse this when you want to specify the column, by default it will show all column (*).\nThis method accept 2 parameter:\n1. `$columns` List of the column, could be in string or an array\n2. `$escape` default is false\n\n```php\n$dt-\u003eselect([\n  'id',\n  'name',\n  'address'\n]);\n\n// or \n$dt-\u003eselect('id, name, address, count(item_id) as total_item', false);\n```\n\n----\n\n### Set Joins table\n- Method: `joins($joins)`\n\nThe parameter is consist of list of join array. I know, it doesn't explain anything so lets jump to the example.\n\n```php\n$dt-\u003ejoins([\n  [\n    'table_2 as tb2',\n    'tb2.table_1_id = tb1.id',\n    'inner'\n  ],\n  // or you can also write it like this\n  [\n    'table' =\u003e 'table_3 as tb3',\n    'on' =\u003e 'tb3.table_2_id = tb2.id AND tb3.is_active = 1',\n    'type' =\u003e 'inner'\n  ]\n]);\n```\n\n----\n\n### Set Conditions or Filter\n- Method: `conditions($conditions)`\n\nBecause this is a simpel datatables library, the filter / conditions that you can use is limited to:\n1. `where`\n2. `whereIn`\n3. `whereNotIn`\n4. `like`\n5. `orLike`\n6. `notLike`\n7. `groupBy`\n\n```php\n$dt-\u003econditions([\n  'where' =\u003e [\n    'id' =\u003e 123,\n    'is_active' =\u003e 1\n  ],\n\n  // whereIn, whereNotIn\n  'whereIn' =\u003e [\n    [\n      'id',\n      [1, 2, 3]\n    ],\n    [\n      'column' =\u003e 'role',\n      'value' =\u003e ['admin', 'user']\n    ]\n  ],\n\n  // like, orLike, notLike\n  'like' =\u003e [\n    [\n      'name',\n      'john',\n      'both'\n    ],\n    [\n      'column' =\u003e 'name',\n      'keyword' =\u003e 'john',\n      'type' =\u003e 'both'\n    ]\n  ],\n\n  'groupBy' =\u003e 'id',\n]);\n```\n\n----\n\n### Set Searching Type\n- Method: `searchType($type)`\n\nThere are 2 type of search that set for this datatables, `simple` one which is datatable default search, and `column` one which you can do search base on the column in datatable. The default value will be `simple`\n\n```php\n$dt-\u003esearchType('column');\n```\n\n----\n\n### Set Order By\n- Method: `orderBy($orders)`\n\n```php\n$dt-\u003eorderBy([\n  [\n    'id',\n    'ASC'\n  ],\n  [\n    'column' =\u003e 'id',\n    'dir' =\u003e 'DESC'\n  ]\n]);\n```\n\n----\n\n### Load the data by the configs that\n- Method: `loadData($table)`\n\nThis method is to load all the data base on whatever configs that you set above. Just pass the table name with alias if you want to.\n\n```php\n$dt-\u003eloadData('users');\n// or\n$dt-\u003eloadData('users as u');\n```\n\n----\n\n### Load by Sql Query\n- Method: `loadQuery($sql, $binding)`\n\nYou can use this method if you prefer using sql query, or you have really complex query, but you have to generate your own search proses.\n\n```php\n$dt-\u003eloadQuery('select * from users order by name ASC');\n```\n\n----\n\n### Examples\n\n```php\n$columns = [\n  'id', \n  'fullname',  \n  'username', \n  'email', \n  'is_active'\n];\n\n$data = $dt\n  -\u003eselect($columns, false)\n  -\u003esearchType('column')\n  -\u003eshowQuery()\n  -\u003eshowConfigs()\n  -\u003eloadData('users as u');\n\n// or\n$columns = [\n  'u.id',\n  'u.name',\n  'us.skill'\n];\n$data = $dt\n  -\u003eselect($columns)\n  -\u003ejoin([\n    [\n      \"user_skils as us\",\n      \"us.user_id = u.id\",\n      \"left\"\n    ]\n  ])\n  -\u003econditions([\n    'where' =\u003e [\n      'u.is_active' =\u003e 1\n    ],\n    'whereIn' =\u003e [\n      ['u.department_id', [3,4,6]]\n    ],\n  ])\n  -\u003eloadData('users as u');\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foniseven%2Fci4-adminlte","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foniseven%2Fci4-adminlte","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foniseven%2Fci4-adminlte/lists"}