Giter VIP home page Giter VIP logo

simpletine / codeigniter4-hmvc Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 3.05 MB

This repository features a modular HMVC (Hierarchical Model-View-Controller) architecture for CodeIgniter 4, integrated with the official authentication system, CodeIgniter 4 Shield. It also includes a comprehensive Admin Dashboard built with AdminLTE, providing a robust foundation for scalable and secure web applications.

License: MIT License

PHP 32.69% Hack 0.20% CSS 50.32% JavaScript 16.78%
codeigniter4 hmvc-codeigniter hmvc-framework simpletine authentication shield

codeigniter4-hmvc's Introduction

Official Website YouTube Channel

Codeigniter 4 HMVC

This repository features a modular HMVC (Hierarchical Model-View-Controller) architecture for CodeIgniter 4, integrated with the official authentication system, CodeIgniter 4 Shield. It also includes a comprehensive Admin Dashboard built with AdminLTE, providing a robust foundation for scalable and secure web applications.

Installation Guide

Create a project

composer create-project simpletine/codeigniter4-starter ci4_hmvc --stability=dev

Copy env file and setup database environment

cp env .env

Run the app, using different port, add options --port=9000

php spark serve

Configuration

Install HMVC package

composer require simpletine/hmvc-shield

Setup Command Line

php spark simpletine:setup

Default Auth

email: [email protected]
password: password

Create User

Use command line to create a new user

php spark shield:user create

Notice

If you are using old versions, after composer update, you need to update the index.php and spark file to root folder (Upgrading to v4.4.8)

composer update
cp vendor/codeigniter4/framework/public/index.php public/index.php
cp vendor/codeigniter4/framework/spark spark

Module Commands

Commands available and funcationality

General

Create a new module named Blogs

php spark module:create Blogs 

Clone a existing module of Blogs and renamed to Items

php spark module:copy Blogs Items 

Create a controller to module Blogs named Categories.php

php spark module:controller Blogs Categories 

Create a model to module Blogs named Categories.php

php spark module:model Blogs Categories 

Publisher

Publish require assets to public folder

php spark publish:assets 

Publish views with AdminLTE to COnfig/Auth.php

php spark publish:views 

Admin

Additional options for the commands

Create a new controller and view to Admin module with AdminLTE

php spark module:controller Admin Users --admin 

Modules Directory

App 
├── Modules      
│   └── Blogs
│       ├──  Config
│           └──  Routes.php
│       ├──  Controllers
│           └──  Blogs.php
│       ├──  Models
│           └──  Blogs.php
│       └──  Views
│           └──  index.php
└── ...  

Route Group

Add new subroutes to blogs named new with method name

$routes->get('new', 'Blogs::new');

Sample of routes group after new subroutes

$routes->group(
    'blogs', ['namespace' => '\Modules\Blogs\Controllers'], function ($routes) {
        $routes->get('/', 'Blogs::index');
        $routes->get('new', 'Blogs::new');
    }
);

PHPCS

Default instance of containing all rules applicable for the CodeIgniter organization

composer run fix

PSR4

At App/Config/Autoload.php, you can configure your custom namespace:

public $psr4 = [
    "Blogs" => APPPATH . "Modules/Blogs", // Example 
    // ...
];

codeigniter4-hmvc's People

Contributors

simpletine avatar valentinechong avatar

Stargazers

 avatar

Watchers

Alex Bueno avatar  avatar

codeigniter4-hmvc's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.