|
Ivi.php is a modern PHP framework designed for developers who want a clean structure, predictable behavior, and fast development without unnecessary complexity. |
Ivi.php is a modern PHP framework designed for building APIs and web applications with clarity and control.
It provides a minimal core with a consistent architecture, allowing developers to build production-ready systems without unnecessary complexity.
The framework focuses on:
- predictable structure
- explicit behavior
- fast development cycles
- real-world features out of the box
composer create-project iviphp/ivi my-app
cd my-appRun the application:
ivi serveuse Ivi\Core\Bootstrap\App;
use Ivi\Http\Request;
$app = new App(__DIR__);
$app->router->get('/', fn() => ['hello' => 'ivi.php']);
$app->router->post('/echo', fn(Request $req) => [
'you_sent' => $req->json()
]);
$app->run();$app->router->get('/users', fn() => ['users' => []]);
$app->router->get('/user/{name}', function (array $params) {
return ['name' => $params['name']];
});$app->router->post('/data', function (Request $req) {
return [
'json' => $req->json(),
'all' => $req->all()
];
});use Ivi\Core\View\View;
$app->router->get('/', function () {
return View::make('home', [
'title' => 'Welcome',
'message' => 'Ivi.php running'
]);
});use Ivi\Core\Validation\Validator;
$input = [
'email' => 'user@example.com',
'password' => 'secret123'
];
$validated = (new Validator($input, [
'email' => 'required|email',
'password' => 'required|min:6'
]))->validate();Update scenario:
$post = ['password' => ''];
if (trim($post['password']) === '') {
unset($post['password']);
}
$validated = (new Validator($post, [
'password' => 'sometimes|min:6'
]))->validate();use Ivi\Core\ORM\Model;
final class User extends Model
{
protected static array $fillable = ['name', 'email', 'password', 'active'];
}$user = User::create([
'name' => 'Alice',
'email' => 'alice@example.com'
]);
$found = User::find(1);
$found->fill(['name' => 'Updated'])->save();
$found->delete();$users = User::query()
->where('status = ?', 'active')
->orderBy('id DESC')
->limit(5)
->get();
$count = User::query()
->where('status = ?', 'active')
->count();use Ivi\Core\ORM\Repository;
final class UserRepository extends Repository
{
protected function modelClass(): string
{
return User::class;
}
public function findByEmail(string $email): ?User
{
$row = User::query()->where('email = ?', $email)->first();
return $row ? new User($row) : null;
}
}use Ivi\Core\Jwt\JWT;
$jwt = new JWT();
$token = $jwt->generate([
'sub' => 123
], [
'key' => 'secret',
'alg' => 'HS256',
'validity' => 3600
]);
$jwt->check($token, ['key' => 'secret']);log_info("Application started");
log_error("Database error", "Database");
log_debug([
'user_id' => 1
], "Debugging");Features:
- daily log rotation
- JSON support
- trace mode
- automatic log directory creation
$v = vector([1, 2, 3]);
$v->push(4);
$m = hashmap(['name' => 'Ivi']);
$m->put('version', '1.0');
$s = hashset(['apple']);
$s->add('banana');
$t = str(" hello ")->trim()->upper();Ivi.php provides a built-in CLI for development and deployment.
ivi new my-appivi migrate
ivi migrate:status
ivi migrate:reset
ivi seedivi make:module Blog
ivi modules:publish-assetsivi serve
ivi test
ivi coverageivi deploy.
├── bootstrap/
├── config/
├── core/
├── public/
├── src/
├── views/
├── scripts/
├── docs/
└── vendor/
Example .env:
APP_ENV=local
APP_DEBUG=true
DB_DRIVER=mysql
DB_HOST=127.0.0.1
DB_NAME=iviphp
DB_USER=root
DB_PASS=secretIvi.php is built around a simple idea:
- keep the core minimal
- expose real capabilities
- avoid hidden magic
- favor explicit code over abstraction
git clone https://github.com/iviphp/ivi.git
cd ivi
composer installuse 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);
}use Ivi\Http\JsonResponse;
use Ivi\Http\HtmlResponse;
return new JsonResponse(['ok' => true]);
return new HtmlResponse('<h1>Hello</h1>');- Set
APP_ENV=production - Use
APP_DEBUG=false - Configure opcache
- Serve from
public/ - Minify assets
Happy building with ivi.php 🚀
MIT License © 2026 Gaspard Kirira
