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.

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 Developed by @CodeWithSushil.


Pinned Loading

  1. clover clover Public

    ๐Ÿ€ Clover PHP: a modern, unopinionated, and lightweight framework.

    PHP 1 1

  2. framework framework Public

    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โ€ฆ