iviphp / 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.
Installs: 41
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
pkg:composer/iviphp/ivi
Requires
- php: >=8.1
- ext-json: *
- cloudinary/cloudinary_php: ^2
- erusev/parsedown: ^1.7
- firebase/php-jwt: ^6.11
- google/apiclient: ^2.15
- predis/predis: ^3.0
- symfony/var-dumper: ^7.0
- vlucas/phpdotenv: ^5.6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^10.0
- dev-main
- v1.4.18
- v1.4.17
- v1.4.16
- v1.4.15
- v1.4.14
- v1.4.13
- v1.4.12
- v1.4.11
- v1.4.10
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.1
- v1.2.0
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.8.0
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-dev
This package is auto-updated.
Last update: 2025-11-26 08:02:05 UTC
README
Ivi.php
๐ฉ 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