ahmedali-dev/codenova
Composer 安装命令:
composer create-project ahmedali-dev/codenova
包简介
php fremwork for handling route and request validation data and easy to use sql
README 文档
README
A lightweight PHP framework for building MVC-style web applications with simple routing, validation, and view handling.
✨ Features
-
🚦 Simple and expressive Routing (supports GET, POST, PUT, PATCH, DELETE)
-
✅ Built-in Validation
-
🖼️ View rendering with layout support
-
⚙️ Lightweight .env loader (pure PHP, no extra packages)
-
📦 Composer autoloading
-
🛠️ Lightweight and easy to extend
📥 Installation
Require the package via Composer:
composer require ahmedali-dev/codenova
Create a public/index.php file as your app entry point:
<?php require __DIR__ . "/../vendor/autoload.php"; // Initialize the view directory Core\Config\ViewSetting::init(); // Load .env file Core\Utils\dotEnv::loader(); // Load route handling use Core\Router\MatchRoute; use Core\Router\Response; use Core\Router\Request;
🚀 Getting Started
1. Define a Route
$route->get("/", function (Request $request, Response $response) { return $response->view("User/Home", [ 'name' => 'Codenova Framework' ]); });
2. Create a View
Create a file at:
app/Views/User/Home.php
<h1>Welcome, <?= $name ?> 👋</h1>
3. Create a Layout
File:
app/Views/Layout/Layout.php
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Codenova App</title> </head> <body> <?= $content ?> </body> </html>
4. Run a Local Server
Start PHP’s built-in server:
php -S localhost:8000 -t public
or use
php start.php
Open your browser at 👉 http://localhost:8000
You should see:
Welcome, Codenova Framework 👋
DB_NAME='hello'
DB_PASS=''
DB_HOST='localhost'''
DB_USER=root
⚙️ Using .env
You can store sensitive configuration in a .env file in your project root:
APP_ENV=local
APP_DEBUG=true
DB_HOST=localhost
DB_USER=root
DB_PASS=password
🚦 Advanced Routing
Dynamic Parameters
$route->get("/user/{id}", function (Request $request, Response $response) { echo "User ID: " . $request->params['id']; });
Multiple Handlers
$route->get("/post/{id}", [ function (Request $request, Response $response) { echo "Closure handler, method: " . $request->method; }, 'Post@show' // Controller@method ]);
404 Handling
$route->notFound([ function () { echo "Page not found, please try again."; }, 'ErrorController@notFound' ]);
✅ Validation Example
$valid = $response->validator([ "name" => ['require', 'isString', 'max:20', 'min:8'], "email" => ['require', 'isEmail', 'extension:gmail.com,hotmail.com'] ]); if ($valid->errors()) { return $response->view("User/Home", ['errors' => $valid->errors()]); } // Access validated data $validated = $valid->validated();
📂 Project Structure
app/
Controllers/
Database/
Helper/
Router/
Views/
Layout/
public/
index.php
vendor/
📜 License
This project is licensed under the MIT License.
⚡ With just a few lines of code, you can have routes, validation, and views working out of the box!
ahmedali-dev/codenova 适用场景与选型建议
ahmedali-dev/codenova 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 09 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ahmedali-dev/codenova 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ahmedali-dev/codenova 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-17