An open API service indexing awesome lists of open source software.

https://github.com/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.
https://github.com/iviphp/ivi

api caching framework lightweight modular orm php spa websocket

Last synced: 3 months ago
JSON representation

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.

Awesome Lists containing this project

README

          


Ivi.php Banner

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_mysql` or `pdo_sqlite`)
- Composer
- Recommended: `php -S localhost:8000 -t public` for local dev

---

## 1) Installation

### A. Create a project

```bash
composer create-project iviphp/ivi my-app
cd my-app
```

> If you cloned the repo directly, run `composer install`.

### B. Project structure (overview)

```bash
.
├─ 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:

```bash
php -S localhost:8000 -t public
```

Open:

You should see the default page or a basic route response (see next section).

---

## 3) Routing

Routes are declared in `config/routes.php`.

```php
get('/', function () {
return 'Hello ivi.php!';
});

$router->get('/users', [UserController::class, 'index']);
$router->get('/users/{id}', [UserController::class, 'show']);
```

---

## 4) Controllers

```php
view('home', [
'title' => 'Welcome to ivi.php',
'message' => 'Fast & expressive.',
], $request);
}
}
```

---

## 5) Views

```php

layout('base', ['title' => $title ?? 'ivi.php']); ?>

= htmlspecialchars($title ?? 'Welcome') ?>


= htmlspecialchars($message ?? '') ?>

```

Layout example:

```php


= htmlspecialchars($title ?? 'ivi.php') ?>

= $styles ?? '' ?>

ivi.php
= $this->section('content') ?>
= $scripts ?? '' ?>

```

---

## 6) Markdown Docs

```php
$router->get('/docs', [\App\Controllers\Docs\DocsController::class, 'index']);
```

View: `views/docs/page.php`

```php


Documentation


Build fast and expressive apps with ivi.php.


= $content ?>

```

---

## 7) Environment & Config

```ini
APP_ENV=local
APP_DEBUG=true
DB_DRIVER=mysql
DB_HOST=127.0.0.1
DB_NAME=iviphp
DB_USER=root
DB_PASS=secret
```

```php
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
'Ada', 'email' => 'ada@example.com']);
$found = User::find(1);
$found->update(['name' => 'Ada Lovelace']);
$found->delete();
```

---

## 9) Migrations CLI

```bash
php bin/ivi migrate
php bin/ivi migrate:status
php bin/ivi migrate:reset
```

Example SQL:

```sql
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(120),
email VARCHAR(190) UNIQUE
);
```

---

## 10) Validation

```php
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

```php
use Ivi\Http\JsonResponse;
use Ivi\Http\HtmlResponse;

return new JsonResponse(['ok' => true]);
return new HtmlResponse('

Hello

');
```

---

## 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](https://github.com/GaspardKirira)
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