Skip to content
@cloverphp

🍀 Clover PHP

Clover PHP is a modern, unopinionated, and lightweight Express.js-style framework for PHP

Clover PHP 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.

TestsPackagist VersionPackagist Dependency VersionPackagist LicensePackagist DownloadsPackagist Stars


✨ Features

🚀 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.


📦 Installation

composer create-project cloverphp/clover my-app
cd my-app
php -S localhost:3000 -t public

🚀 Quick Start

<?phprequire_once__DIR__ . "/vendor/autoload.php";
useClover\Clover;
useClover\Http\Request;
useClover\Http\Response;
$app = newClover();
$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);

📂 Project Structure

my-app/
├── app/
│ ├── Controllers/
│ ├── Models/
│ └── Views/
├── public/
│ └── index.php
├── vendor/
├── composer.json
└── README.md

🔑 Example Middleware

$app->use(function (Request$req, Response$res, callable$next) {
$res->setHeader("X-Powered-By", "Clover PHP");
$next($req, $res);
});

🛡️ License

Clover PHP is open-sourced software licensed under the Packagist License Developed by @CodeWithSushil.


Pinned Loading

  1. clovercloverPublic

    🍀 Clover PHP: a modern, unopinionated, and lightweight framework.

    PHP 1 1

  2. frameworkframeworkPublic

    Clover PHP Framework.

    PHP 1

Repositories

Showing 10 of 15 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…