|
1 |
| -# CodeIgniter 4 Application Starter |
| 1 | + |
| 2 | +CodeIgniter 4 Application Boilerplate |
| 3 | +===================================== |
| 4 | + |
| 5 | +[](https://github.styleci.io/repos/243432201) |
| 6 | + |
| 7 | + |
| 8 | +[](https://github.com/agungsugiarto/boilerplate/stargazers) |
| 9 | +[](https://github.com/agungsugiarto/boilerplate/blob/master/LICENSE.md) |
| 10 | + |
| 11 | +Feature |
| 12 | +------- |
| 13 | +* Configurable backend theme [AdminLTE 3](https://adminlte.io/docs/3.0/) |
| 14 | +* Css framework [Bootstrap 4](https://getbootstrap.com/) |
| 15 | +* Icons by [Font Awesome 5](https://fontawesome.com/) |
| 16 | +* Role-based permissions provided by [Myth/Auth](https://github.com/lonnieezell/myth-auth) |
| 17 | +* Menu dynamically |
| 18 | +* Localized English / Indonesian |
| 19 | + |
| 20 | +This project is early on development feel free to contribute |
| 21 | +------------------------------------------------------------ |
| 22 | +Screenshoot | Demo On [Heroku](https://boilerplate-codeigniter4.herokuapp.com/) |
| 23 | +------------------------------------------------------------------------------- |
| 24 | + |
| 25 | + |
| 26 | +Installation |
| 27 | +------------ |
| 28 | + |
| 29 | +**1.** Get The Module |
| 30 | + |
| 31 | + require via composer |
| 32 | + |
| 33 | +```bash |
| 34 | +composer require agungsugiarto/boilerplate |
| 35 | +``` |
| 36 | + |
| 37 | +**2.** Set CI_ENVIRONMENT, base url, index page, and database config in your `.env` file based on your existing database (If you don't have a `.env` file, you can copy first from `env` file: `cp env .env` first). If the database not exists, create database first. |
| 38 | + |
| 39 | +```bash |
| 40 | +# .env file |
| 41 | +CI_ENVIRONMENT = development |
| 42 | + |
| 43 | +app.baseURL = 'http://localhost:8080' |
| 44 | +app.indexPage = '' |
| 45 | + |
| 46 | +database.default.hostname = localhost |
| 47 | +database.default.database = boilerplate |
| 48 | +database.default.username = root |
| 49 | +database.default.password = |
| 50 | +database.default.DBDriver = MySQLi |
| 51 | +``` |
| 52 | +**3.** Run publish auth |
| 53 | +```bash |
| 54 | +php spark auth:publsih |
| 55 | + |
| 56 | +Publish Migration? [y, n]: n |
| 57 | +Publish Models? [y, n]: n |
| 58 | +Publish Entities? [y, n]: n |
| 59 | +Publish Controller? [y, n]: n |
| 60 | +Publish Views? [y, n]: n |
| 61 | +Publish Config file? [y, n]: y |
| 62 | + created: Config/Auth.php |
| 63 | +Publish Language file? [y, n]: |
| 64 | +``` |
| 65 | + |
| 66 | +> NOTE: Everything about how to configure auth you find add [Myth/Auth](https://github.com/lonnieezell/myth-auth). |
| 67 | +
|
| 68 | + |
| 69 | +Its done ? not to fast. After the publish `Config/Auth.php` you need to change |
| 70 | +`public $views` with below like this. |
| 71 | +```php |
| 72 | +public $views = [ |
| 73 | + 'login' => 'agungsugiarto\boilerplate\Views\Authentication\login', |
| 74 | + 'register' => 'agungsugiarto\boilerplate\Views\Authentication\register', |
| 75 | + 'forgot' => 'agungsugiarto\boilerplate\Views\Authentication\forgot', |
| 76 | + 'reset' => 'agungsugiarto\boilerplate\Views\Authentication\reset', |
| 77 | + 'emailForgot' => 'agungsugiarto\boilerplate\Views\Authentication\emails\fogot', |
| 78 | + 'emailActivation' => 'agungsugiarto\boilerplate\Views\Authentication\emails\acivation', |
| 79 | +]; |
| 80 | +``` |
| 81 | + |
| 82 | +Open `app\Config\Filters.php` see at `$aliases` add with below like this. |
| 83 | +```php |
| 84 | +public $aliases = [ |
| 85 | + 'login' => \Myth\Auth\Filters\LoginFilter::class, |
| 86 | + 'role' => \agungsugiarto\boilerplate\Filters\RoleFilter::class, |
| 87 | + 'permission' => \agungsugiarto\boilerplate\Filters\PermissionFilter::class, |
| 88 | +]; |
| 89 | +``` |
| 90 | + |
| 91 | +**4.** Run publish, migrate and seed boilerplate |
| 92 | + |
| 93 | +```bash |
| 94 | +php spark boilerplate:install |
| 95 | +``` |
| 96 | + |
| 97 | +**5.** Run development server: |
| 98 | + |
| 99 | +```bash |
| 100 | +php spark serve |
| 101 | +``` |
| 102 | + |
| 103 | +**6.** Open in browser http://localhost:8080/admin |
| 104 | +```bash |
| 105 | +Default user and password |
| 106 | ++----+--------+-------------+ |
| 107 | +| No | User | Password | |
| 108 | ++----+--------+-------------+ |
| 109 | +| 1 | admin | super-admin | |
| 110 | +| 2 | user | super-user | |
| 111 | ++----+--------+-------------+ |
| 112 | +``` |
| 113 | + |
| 114 | +Settings |
| 115 | +-------- |
| 116 | + |
| 117 | +Config Boilerplate |
| 118 | + |
| 119 | +You can configure default dashboard controller and backend theme in `app\Config\Boilerplate.php`, |
| 120 | + |
| 121 | +```php |
| 122 | +class Boilerplate extends BaseConfig |
| 123 | +{ |
| 124 | + public $appName = 'Boilerplate'; |
| 125 | + |
| 126 | + public $dashboard = [ |
| 127 | + 'namespace' => 'agungsugiarto\boilerplate\Controllers', |
| 128 | + 'controller' => 'DashboardController::index', |
| 129 | + 'filter' => 'permission:back-office', |
| 130 | + ]; |
| 131 | +// App/Config/Boilerplate.php |
| 132 | +``` |
| 133 | + |
| 134 | +Usage |
| 135 | +----- |
| 136 | +You can find how its work with the read code routes, controller and views etc. Finnaly happy coding! |
| 137 | + |
| 138 | +Contributing |
| 139 | +------------ |
| 140 | +Contributions are very welcome. |
| 141 | + |
| 142 | +License |
| 143 | +------- |
| 144 | + |
| 145 | +This package is free software distributed under the terms of the [MIT license](LICENSE.md). |
0 commit comments