cloverphp/framework 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cloverphp/framework

最新稳定版本:v0.0.2

Composer 安装命令:

composer require cloverphp/framework

包简介

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

README 文档

README

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

统计信息

  • 总下载量: 216
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-28