Clover PHP is a modern, unopinionated, and lightweight Express.js-style framework for PHP 8.4. It helps you build REST APIs, web apps, and microservices with the simplicity of Express.js and the power of modern PHP.
π Minimal & Fast β Simple API design, inspired by Express.js.
β‘ Async Support β Built with PHP Fibers & AMPHP for non-blocking I/O.
ποΈ Routing System β Intuitive get(), post(), etc., with async router support.
π Auth Ready β Supports sessions, cookies, and JWT-based authentication.
π§© Extensible Middleware β Add global and route-level middleware for logging, security, and validation.
πΎ Database Agnostic β Works with both SQL and NoSQL databases.(Upcoming)
π οΈ MVC Support β Controllers, models, and views with interfaces for clean architecture.
π‘οΈ Error Handling & Logging β Developer-friendly error responses and logging tools.
π¨ Unopinionated β Flexible enough for small apps or large enterprise projects.
π¦ Composer & PSR-12 β Modern PHP practices with full Composer/PSR-12 compliance.
composer create-project cloverphp/clover my-app
cd my-app
php -S localhost:3000 -t public
<?php
require_once __DIR__ . "/vendor/autoload.php";
use Clover\Clover;
use Clover\Http\Request;
use Clover\Http\Response;
$app = new Clover();
$router = $app->router();
// Home route
$router->get("/", fn(Request $req, Response $res) =>
$res->send("<h1>Welcome to π Clover PHP!</h1>"));
$router->post("/", fn(Request $req, Response $res) =>
$res->json(['name' => 'Clover PHP!'])
);
$app->run(3000, true);
my-app/
βββ app/
β βββ Controllers/
β βββ Models/
β βββ Views/
βββ public/
β βββ index.php
βββ vendor/
βββ composer.json
βββ README.md
$app->use(function (Request $req, Response $res, callable $next) {
$res->setHeader("X-Powered-By", "Clover PHP");
$next($req, $res);
});
Clover PHP is open-sourced software licensed under the