定制 hamkamannan/adminigniter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hamkamannan/adminigniter

Composer 安装命令:

composer require hamkamannan/adminigniter

包简介

Complete Authentication and Authorization system for CodeIgniter4 HMVC with Premium Admin LTE

README 文档

README

Adminigniter

HMVC Module (CRUD) Generator with Complete Authentication and Authorization system for CodeIgniter4 comes with Admin LTE Template.

Feature

NOTE: This library was inspired from myth/auth and agungsugiarto/boilerplate

Please feel free to contribute!

Demo On mannan.id

Installation

1. Get The Module

NOTE: Since the myth/auth packages is still under development, we need to change composer.json in root project directory. Open composer.json with your text editor and add code like this, or below like this.

"minimum-stability": "dev",
"prefer-stable": true,

And run require via composer

composer require hamkamannan/adminigniter

2. Codeigniter Config

NOTE: Set up your CI_ENVIRONMENT, baseURL, 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 does not exist, create the database first.

#--------------------------------------------------------------------
# ENVIRONMENT
#--------------------------------------------------------------------

CI_ENVIRONMENT = development

#--------------------------------------------------------------------
# APP
#--------------------------------------------------------------------

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

#--------------------------------------------------------------------
# DATABASE
#--------------------------------------------------------------------

# mysql
database.default.hostname = 127.0.0.1
database.default.database = adminigniter
database.default.username = root
database.default.password = root
database.default.DBDriver = MySQLi

3. Run publish, migrate, seed

NOTE: To publish Database/Migration, Database/Seed, public/assets, public/themes, Libraries/DataTables, and patch HMVC vendor/codeigniter4/framework/system/View/View.php

  • Run php spark adminigniter:publish
php spark adminigniter:publish

Publish Database Migration? [y, n]: y
  created: Database/Migrations/20210101_000000_Auth
  created: Database/Migrations/20210101_000001_AuthAlterUser
  created: Database/Migrations/20210101_000002_Adminigniter
Publish Database Seed? [y, n]: y
  created: Database/Seeds/AdminigniterSeeder.php
Copy Public Assets? [y, n]: y
  created: public/assets/*
  created: public/themes/*
Copy Libraries? (Adminigniter Libraries/DataTables) [y, n]: y
  created: Libraries/DataTables//Utilities/*
  created: Libraries/DataTables/*
Patch View for HMVC? [y, n]: y
  created: vendor/codeigniter4/framework/system/View/View.php
  • Run php spark migrate
php spark migrate

  Running: (App) 20210101_000000_App/Database/Migrations/Auth
  Running: (App) 20210101_000001_App/Database/Migrations/AuthAlterUsers
  Running: (App) 20210101_000002_App/Database/Migrations/Adminigniter
  • Run php spark db:seed AdminigniterSeeder
php spark db:seed AdminigniterSeeder

  Seeded: App/Database/Seeds/AdminigniterSeeder

4. Configuration (Auth, Filter, and Autoload)

NOTE: Everything about how to configure auth you can find add myth/auth

  • app/Config/Auth.php Open app/Config/Auth.php find $views, $passwordValidators and etc and changes with these lines below:
public $defaultUserGroup = 'user';

public $views = [
  'login'           => 'hamkamannan\adminigniter\Views\auth\login',
  'register'        => 'hamkamannan\adminigniter\Views\auth\register',
  'forgot'          => 'hamkamannan\adminigniter\Views\auth\forgot',
  'reset'           => 'hamkamannan\adminigniter\Views\auth\reset',
  'emailForgot'     => 'hamkamannan\adminigniter\Views\auth\emails\forgot',
  'emailActivation' => 'hamkamannan\adminigniter\Views\auth\emails\activation',
];

public $allowRegistration = true;
public $requireActivation = false; 
public $activeResetter = false;
public $allowRemembering = true;

public $passwordValidators = [
  'Myth\Auth\Authentication\Passwords\CompositionValidator',
  'Myth\Auth\Authentication\Passwords\NothingPersonalValidator',
  'Myth\Auth\Authentication\Passwords\DictionaryValidator',
  'Myth\Auth\Authentication\Passwords\PwnedValidator',
];
  • app/Config/Filters.php Open app/Config/Filters.php, find $aliases and add these lines below:
public $aliases = [
  'csrf'     => CSRF::class,
  'toolbar'  => DebugToolbar::class,
  'honeypot' => Honeypot::class,
  'login'         => \Myth\Auth\Filters\LoginFilter::class,
  'role'          => \hamkamannan\adminigniter\Filters\RoleFilter::class,
  'permission'    => \hamkamannan\adminigniter\Filters\PermissionFilter::class,
];
  • app/Config/Autoload.php Open app/Config/Autoload.php, find $psr4 and add these lines below:
public $psr4 = [
  APP_NAMESPACE   => APPPATH, // For custom app namespace
  'App'           => APPPATH,
  'Config'        => APPPATH . 'Config',
  'DataTables'    => APPPATH . 'Libraries/DataTables',
  'Adminigniter'  => APPPATH . 'Adminigniter',
];

5. Run Module Generator

NOTE: This provide command to create new module and clone available module (Dashboard, Report, Banner, Page).

  • Run php spark module:create Dummy
php spark module:create Dummy

  created: Adminigniter/Database/Migrations/2021-05-16-050256_Dummy.php
  created: Adminigniter/Modules/Backend/Dummy/Config/Routes.php
  created: Adminigniter/Modules/Backend/Dummy/Controllers/Dummy.php
  created: Adminigniter/Modules/Backend/Dummy/Controllers/Api/Dummy.php
  created: Adminigniter/Modules/Backend/Dummy/Models/DummyModel.php
  created: Adminigniter/Modules/Backend/Dummy/Views/list.php
  created: Adminigniter/Modules/Backend/Dummy/Views/add.php
  created: Adminigniter/Modules/Backend/Dummy/Views/update.php
  • Run php spark module:clone Page
php spark module:clone Page

  created: Adminigniter/Modules/Backend/Page/Config
  created: Adminigniter/Modules/Backend/Page/Models
  created: Adminigniter/Modules/Backend/Page/Controllers
  created: Adminigniter/Modules/Backend/Page/Views
  created: Adminigniter/Modules/Backend/Page
  created: Module Page has been clone
  created: Adminigniter/Database/Migrations/2021-05-16-102329_Page.php
  • Run php spark migrate -n Adminigniter
php spark migrate -n Adminigniter

  Running: (Adminigniter) 2021-05-16-050256_App/Adminigniter/Database/Migrations/Dummy  
  Running: (Adminigniter) 2021-05-16-102329_App/Adminigniter/Database/Migrations/Page  

6. Run development server:

NOTE: Running on port 8888

php spark serve --port 8888

7. Open in browser http://localhost:8888/dummy

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

Usage

You can find how it works with the read code routes, controller and views etc.

Contributing

Contributions are very welcome.

License

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

统计信息

  • 总下载量: 314
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固