jijihohococo / ichi
Ichi PHP MVC Framework
Requires
- jijihohococo/ichi-orm: ^3.2
- jijihohococo/ichi-route: ^2.0
- jijihohococo/ichi-template: ^2.4
- jijihohococo/ichi-validation: ^1.7
- jijihohococo/php-env: ^1.3
This package is auto-updated.
Last update: 2026-03-08 07:02:33 UTC
README
ICHI PHP FRAMEWORK is a fast and secure MVC PHP framework.
License
This framework is open source under the MIT license.
Table of Contents
Installation
composer create-project jijihohococo/ichi your_project
Setup
First, you must create a .env file in your project folder. Then declare your actual database name, database username, and password in that file.
You can see the required format in .env.example under your project folder.
In your .env file
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_database_name DB_USERNAME=your_database_user_name DB_PASSWORD=your_database_password
You can run the app from the public path:
your_project/public > php -S localhost:8000
Using
Route
You can add routes in the web function of routes/web.php.
If you want to add another route file, create a new file under the routes folder.
Then add a new function similar to web.php.
function new_routes($route) { }
Then include your new route file in app/Kernel.php:
namespace App; use JiJiHoHoCoCo\IchiRoute\Router\Route; require_once __DIR__ . '/../routes/new_routes.php'; class Kernel { public function run() { $route = new Route; new_routes($route); $route->run(); } }
The code above highlights what is needed to add a new route file.
You can use this documentation for route functions in detail.
Middleware
You can create middleware for routes from the command line.
php ichi make:middleware NewMiddleware
The middleware class will be created under the app/Middleware folder.
You can use this documentation for middleware functions in detail.
Model
You can add another database connection in app/Kernel.php, as shown in this documentation.
You can create a model from the command line.
php ichi make:model NewModel
The model class will be created under the app/Models folder.
Example model
namespace App\Models; use JiJiHoHoCoCo\IchiORM\Database\Model; class NewModel extends Model { public $id , $name , $created_at , $updated_at , $deleted_at ; }
You can use this documentation for model usage details.
Controller
You can create a controller from the command line.
php ichi make:controller NewController
The controller class will be created under the app/Controllers folder.
For more details, use this documentation.
View
You can create a view component class from the command line.
php ichi make:component ViewComponent
The view component class will be created under the app/Components folder.
You can return a view in a route callback or in a controller method.
Without controller
$route->get('/welcome',function(){ return view('welcome.php'); });
With controller
$route->get('/welcome','HomeController@welcome');
namespace App\Controllers; class HomeController { public function welcome() { return view('welcome.php'); } }
You must create view PHP files under the resources/views folder.
For more details, use this documentation.
Validation
You can validate input data in your controller class.
namespace App\Controllers; use JiJiHoHoCoCo\IchiValidation\Validator; class TestController { public function test() { $validator = new Validator(); if(!$validator->validate($_REQUEST,[ 'name' => 'required' , 'age' => 'required|integer' , 'email' => ['required','email'] ])) { setErrors($validator->getErrors()); return view('test.php'); } } }
You can display validation error messages in your view PHP file:
<?php if(isset($errors['name'])): ?> <?php echo $errors['name']; ?> <?php endif; ?>
For more details, use this documentation.