nabeelalihashmi/nthphp
Composer 安装命令:
composer create-project nabeelalihashmi/nthphp
包简介
A fast, optimized PHP framework to make own framework with PHP attributes, automatic routing of Blade views.
README 文档
README
NthPHP is a fast, optimized PHP framework designed to speed up and simplify web development using automatic routing and providing great developer experience. Not only it can run in a traditional PHP environment with Apache, Nginx, LiteSpeed, or any other similar web server, but also it provides high performance, leveraging Swoole for asynchronous, coroutine-based processing, allowing your application to handle thousands of requests concurrently without requiring any changes in code.
Installation
Download this repo or clone this repo or run following command:
composer create-project nabeelalihashmi/nthphp app_name
Screenshots
Built around a clean and minimal architecture, NthPHP uses PHP attributes for routing, automatic routing for Blade views, a flexible Blade templating engine for views, and a powerful ORM (RedBeanPHP) for database access. With built-in support for middleware and an easy-to-use configuration system, it simplifies common tasks like request handling, email sending, and validation.
Key Features
- Fast & Optimized: NthPHP is built for speed, providing an efficient routing system and optimized performance.
- PHP Attributes for Routing: Routes are defined using PHP attributes, allowing for a clean, modern approach to routing.
- Automatic Routing: Routes are automatically collected from controllers, reducing the need for manual route registration.
- Blade Templating: Uses BladeOne as the templating engine, with automatic routes generation from views stored in a specific folder (
/app/Views/_pages). - RedBeanPHP: Uses RedBeanPHP for database interactions. No need for models, but models can be used if desired.
- Swoole Integration: NthPHP can utilize Swoole for asynchronous, coroutine-based performance, dramatically improving scalability and handling of concurrent requests. It can run in Swoole for better performance without changing the core code base.
- Compatibility with Apache/Nginx/LiteSpeed: NthPHP is fully compatible with traditional web servers like Apache, Nginx, and LiteSpeed. Whether you deploy on Swoole for concurrency and performance boosts or use a traditional web server, the same code works seamlessly across all environments, making the framework extremely flexible.
Configuration
The configuration is stored in app/config.php and includes settings for routing, controllers, views, server config etc. NthPHP provides a class Config to read the config with dot notation, with Config::get method to read the configuration.
$baseUrl = Config::get('app.base_url');
Automatic Views Directory
The framework uses Blade templating with the default directory for views located at /app/Views.
In routing, if automatic_routes have value other than false, e.g,
'automatic_routes' => ['_pages', '_other_dir_in_views' ]
then blade view files in /app/Views/_pages and _other_dir_in_views, are considered as routes.
Manual Routes
It is possible to define own routes in app/Routes directory. A php file here, must return an array of route arrays. A route array has following keys:
-method
-path
-handler
-middleware
Check demo files for example.
If file name is root.php, then routes of that and mounted with group. For other name, such as demos.php, any route define in it will automatically prepend demos in routes.
Documentation
- Blade: Laravel Blade Documentation
- BladeOne: BladeOne GitHub Repository
- RedBeanPHP: RedBeanPHP Documentation
Installation
- Clone the repository or download the framework.
- Run
composer installto install the required dependencies. - Configure your database and other settings as needed.
- Start developing your application by creating controllers and views.
Usage
- Define routes in your controllers using PHP attributes.
#[Route(method, uri, middleware)]
#[Route(['GET', 'POST'], '/user/{name}', [AuthMiddleware::class])]
-
Views in
app/views/_pagesare automatically rendered based on routes, with Blade templating. -
Database interactions can be handled using RedBeanPHP, with or without models.
-
The framework can run on Swoole, Apache, Nginx, LiteSpeed, or any other similar server environment without any changes to your code.
php server.php
Caching
Please note that when routes are changed, and caching is set to true in the config, please delete cache/routes/collector.cache and cache/routes/routes.cache files.
Developer
This framework is developed by Nabeel Ali. You can connect with the developer on LinkedIn:
- Nabeel Ali
- Co-Founder and Creator of Aliveforms
- Founder and Creator Quizrella
This is just the beginning. NthPHP is a work in progress and continuously evolving.
nabeelalihashmi/nthphp 适用场景与选型建议
nabeelalihashmi/nthphp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 01 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「routing」 「php」 「mvc」 「fast」 「blade」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nabeelalihashmi/nthphp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nabeelalihashmi/nthphp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nabeelalihashmi/nthphp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Write down your routing mapping at one place
Flight routing is a simple, fast PHP router that is easy to get integrated with other routers.
Client for Google Directions API to add interpolated points to a route consisting of given coordinates.
Alfabank REST API integration
A router designed for web requests for the Monolith framework
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-31



