Skip to content

πŸ€ Clover: Clover PHP is a modern, unopinionated, and lightweight Express.js-style framework for PHP.

License

Notifications You must be signed in to change notification settings

CodeWithSushil/clover

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

CloverPHP

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.

Code Coverage CodeQL Tests Packagist Version Packagist Dependency Version Packagist License Packagist Downloads Packagist 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

<?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);

πŸ“‚ 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


About

πŸ€ Clover: Clover PHP is a modern, unopinionated, and lightweight Express.js-style framework for PHP.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 85.3%
  • Hack 14.7%