Ivi
Ivi.php is a fast, lightweight, and modular PHP framework with expressive routing, built-in ORM, caching, and WebSocket support—ideal for modern APIs and SPAs.
Install / Use
/learn @iviphp/IviREADME
🟩 Ivi.php — Simple. Modern. Expressive.
“Code with clarity.”
Ivi.php is a modern PHP framework built for developers who value simplicity, speed, and expressive code.
Its minimal core and clean structure make building APIs and web applications a joyful experience.
🚀 Getting Started
Welcome to Ivi.php — a lightweight, modern framework designed to help you build fast and elegant PHP applications.
This guide will walk you through:
- Bootstrapping a new project
- Understanding the folder layout
- Creating your first route, controller, and view
- Connecting to a database with ease
Requirements
- PHP 8.2+
- PDO + driver (e.g.
pdo_mysqlorpdo_sqlite) - Composer
- Recommended:
php -S localhost:8000 -t publicfor local dev
1) Installation
A. Create a project
composer create-project iviphp/ivi my-app
cd my-app
If you cloned the repo directly, run
composer install.
B. Project structure (overview)
.
├─ bootstrap/ # app boot strap & helpers
├─ config/ # app, routes, database config
├─ core/ # ivi.php framework core (Bootstrap, Http, ORM, ...)
├─ public/ # web root (index.php)
├─ src/ # your application code (Controllers, Models, ...)
├─ views/ # PHP templates
├─ scripts/ # migrations, seeds, dev scripts
├─ docs/ # documentation
└─ vendor/
2) First Run
Serve the app:
php -S localhost:8000 -t public
Open: http://localhost:8000
You should see the default page or a basic route response (see next section).
3) Routing
Routes are declared in config/routes.php.
<?php
use Ivi\Router\Router;
use App\Controllers\HomeController;
use App\Controllers\User\UserController;
/** @var Router $router */
$router->get('/', function () {
return 'Hello ivi.php!';
});
$router->get('/users', [UserController::class, 'index']);
$router->get('/users/{id}', [UserController::class, 'show']);
4) Controllers
<?php
namespace App\Controllers;
use Ivi\Http\Request;
use Ivi\Http\HtmlResponse;
final class HomeController extends Controller
{
public function index(Request $request): HtmlResponse
{
return $this->view('home', [
'title' => 'Welcome to ivi.php',
'message' => 'Fast & expressive.',
], $request);
}
}
5) Views
<!-- views/home.php -->
<?php $this->layout('base', ['title' => $title ?? 'ivi.php']); ?>
<section class="section container">
<h1><?= htmlspecialchars($title ?? 'Welcome') ?></h1>
<p><?= htmlspecialchars($message ?? '') ?></p>
</section>
Layout example:
<!-- views/base.php -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?= htmlspecialchars($title ?? 'ivi.php') ?></title>
<link href="<?= asset('assets/css/app.css') ?>" rel="stylesheet">
<?= $styles ?? '' ?>
</head>
<body>
<nav class="nav"><a href="/">ivi.php</a></nav>
<main><?= $this->section('content') ?></main>
<?= $scripts ?? '' ?>
</body>
</html>
6) Markdown Docs
$router->get('/docs', [\App\Controllers\Docs\DocsController::class, 'index']);
View: views/docs/page.php
<section class="docs-hero">
<div class="container">
<h1>Documentation</h1>
<p class="lead">Build fast and expressive apps with <strong>ivi.php</strong>.</p>
</div>
</section>
<main class="docs-content container markdown-body">
<?= $content ?>
</main>
7) Environment & Config
APP_ENV=local
APP_DEBUG=true
DB_DRIVER=mysql
DB_HOST=127.0.0.1
DB_NAME=iviphp
DB_USER=root
DB_PASS=secret
return [
'default' => $_ENV['DB_DRIVER'] ?? 'mysql',
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => $_ENV['DB_HOST'] ?? '127.0.0.1',
'database' => $_ENV['DB_NAME'] ?? 'iviphp',
'username' => $_ENV['DB_USER'] ?? 'root',
'password' => $_ENV['DB_PASS'] ?? '',
],
],
];
8) ORM Quickstart
<?php
namespace App\Models;
use Ivi\Core\ORM\Model;
final class User extends Model
{
protected string $table = 'users';
}
Usage:
use App\Models\User;
$user = User::create(['name' => 'Ada', 'email' => 'ada@example.com']);
$found = User::find(1);
$found->update(['name' => 'Ada Lovelace']);
$found->delete();
9) Migrations CLI
php bin/ivi migrate
php bin/ivi migrate:status
php bin/ivi migrate:reset
Example SQL:
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(120),
email VARCHAR(190) UNIQUE
);
10) Validation
use Ivi\Http\Request;
use Ivi\Validation\Validator;
$validator = Validator::make($request->all(), [
'name' => 'required|min:2|max:120',
'email' => 'required|email',
]);
if ($validator->fails()) {
return response()->json(['errors' => $validator->errors()], 422);
}
11) Responses
use Ivi\Http\JsonResponse;
use Ivi\Http\HtmlResponse;
return new JsonResponse(['ok' => true]);
return new HtmlResponse('<h1>Hello</h1>');
12) Production Tips
- Set
APP_ENV=production - Use
APP_DEBUG=false - Configure opcache
- Serve from
public/ - Minify assets
Happy building with ivi.php 🚀
⚖️ License
MIT License © 2025 GaspardKirira Authors
Use freely, modify openly, contribute boldly. 🚀
Test Packagist Hook
- hook test Fri Nov 7 08:07:12 PM EAT 2025
- packagist hook test
- packagist hook test
Related Skills
canvas
347.6kCanvas Skill Display HTML content on connected OpenClaw nodes (Mac app, iOS, Android). Overview The canvas tool lets you present web content on any connected node's canvas view. Great for: -
gh-issues
347.6kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
oracle
347.6kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
taskflow-inbox-triage
347.6kname: taskflow-inbox-triage description: Example TaskFlow authoring pattern for inbox triage. Use when messages need different treatment based on intent, with some routes notifying immediately, some w
