/boilerplate

CodeIgniter4 Boilerplate based on AdminLTE 3 with user management, roles, permissions, ...

Primary LanguagePHPMIT LicenseMIT

CodeIgniter 4 Application Boilerplate

Package StyleCI PHP Composer GitHub All Releases GitHub stars GitHub license

Feature

This project is early on development feel free to contribute

Screenshoot | Demo On Heroku

Dashboard

Installation

1. Get The Module

require via composer

composer require agungsugiarto/boilerplate

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.

# .env file
CI_ENVIRONMENT = development

app.baseURL = 'http://localhost:8080'
app.indexPage = ''

database.default.hostname = localhost
database.default.database = boilerplate
database.default.username = root
database.default.password =
database.default.DBDriver = MySQLi

3. Run publish auth

php spark auth:publsih

Publish Migration? [y, n]: n
Publish Models? [y, n]: n
Publish Entities? [y, n]: n
Publish Controller? [y, n]: n
Publish Views? [y, n]: n
Publish Config file? [y, n]: y
  created: Config/Auth.php
Publish Language file? [y, n]:

NOTE: Everything about how to configure auth you find add Myth/Auth.

Its done ? not to fast. After the publish Config/Auth.php you need to change public $views with below like this.

public $views = [
    'login'           => 'agungsugiarto\boilerplate\Views\Authentication\login',
    'register'        => 'agungsugiarto\boilerplate\Views\Authentication\register',
    'forgot'          => 'agungsugiarto\boilerplate\Views\Authentication\forgot',
    'reset'           => 'agungsugiarto\boilerplate\Views\Authentication\reset',
    'emailForgot'     => 'agungsugiarto\boilerplate\Views\Authentication\emails\fogot',
    'emailActivation' => 'agungsugiarto\boilerplate\Views\Authentication\emails\acivation',
];

Open app\Config\Filters.php see at $aliases add with below like this.

public $aliases = [
	'login'      => \Myth\Auth\Filters\LoginFilter::class,
	'role'       => \agungsugiarto\boilerplate\Filters\RoleFilter::class,
	'permission' => \agungsugiarto\boilerplate\Filters\PermissionFilter::class,
];

4. Run publish, migrate and seed boilerplate

php spark boilerplate:install

5. Run development server:

php spark serve

6. Open in browser http://localhost:8080/admin

Default user and password
+----+--------+-------------+
| No | User   | Password    |
+----+--------+-------------+
| 1  | admin  | super-admin |
| 2  | user   | super-user  |
+----+--------+-------------+

Settings

Config Boilerplate

You can configure default dashboard controller and backend theme in app\Config\Boilerplate.php,

class Boilerplate extends BaseConfig
{
    public $appName = 'Boilerplate';

    public $dashboard = [
        'namespace'  => 'agungsugiarto\boilerplate\Controllers',
        'controller' => 'DashboardController::index',
        'filter'     => 'permission:back-office',
    ];
// App/Config/Boilerplate.php

Usage

You can find how its work with the read code routes, controller and views etc. Finnaly happy coding!

Contributing

Contributions are very welcome.

License

This package is free software distributed under the terms of the MIT license.