quidphp/routing
Composer 安装命令:
composer require quidphp/routing
包简介
PHP library that provides a route matching and triggering procedure
关键字:
README 文档
README
About
QuidPHP/Routing is a PHP library that provides a route matching and triggering procedure. It is part of the QuidPHP package and can also be used standalone.
License
QuidPHP/Routing is available as an open-source software under the MIT license.
Documentation
QuidPHP/Routing documentation is available at QuidPHP/Docs.
Installation
QuidPHP/Routing can be easily installed with Composer. It is available on Packagist.
$ composer require quidphp/routing
Once installed, the Quid\Routing namespace will be available within your PHP application.
Requirement
QuidPHP/Routing requires the following:
- PHP 8.1
- All requirements of quidphp/main
Dependency
QuidPHP/Routing has the following dependency:
- quidphp/main - Quid\Main - PHP library that provides a set of base objects and collections
The dependency will be resolved by using the Composer installation process.
Comment
QuidPHP/Routing code is commented and all methods are explained (in French).
Convention
QuidPHP/Routing is built on the following conventions:
- Coding: No curly braces are used in a IF statement if the condition can be resolved in only one statement.
- Config: A special $config static property exists in all classes. This property gets recursively merged with the parents' property on initialization.
- M-VC: A route object serves as both a View and a Controller. There should be one route class per route.
- Segment: A segment within a route path represents a dynamic value. It is wrapped around brackets. A callable that accepts or rejects the value needs to be provided.
- Templating: Once the route is triggered, the developer has complete control and can use any HTML rendering technology it desires. Or, simply use the Quid\Base\Html methods to generate the HTML and use traits for reusable page components.
- Traits: Traits filenames start with an underscore (_).
- Type: Files, function arguments and return types are strict typed.
Overview
QuidPHP/Routing contains 14 classes and traits. Here is an overview:
- BreakException - Class for an exception which breaks the root matching loop
- Exception - Class used for a route exception, the next available route will instead be triggered
- Flash - Class for a collection containing flash-like data, manages route key
- Nav - Class for storing route navigation-related data
- Redirection - Class managing a URI redirection array
- Request - Extended class with methods to route an HTTP request
- RequestHistory - Extended class for a collection containing a history of requests
- Route - Abstract class for a route that acts as both a View and a Controller
- RouteRequest - Class that analyzes if a request matches a route
- RouteSegmentRequest - Class that analyzes if a request matches a route with segment (non-static value)
- Routes - Class for a collection of many untriggered routes
- Session - Extended class that adds session support for routes
- _attrRoute - Trait that provides methods to work with routes in the attributes property
- _service - Trait that provides methods to link a service to a route
Testing
QuidPHP/Routing contains 7 test classes:
- BreakException - Class for testing Quid\Routing\BreakException
- Exception - Class for testing Quid\Routing\Exception
- Nav - Class for testing Quid\Routing\Nav
- Redirection - Class for testing Quid\Routing\Redirection
- Request - Class for testing Quid\Routing\Request
- RequestHistory - Class for testing Quid\Routing\RequestHistory
- Session - Class for testing Quid\Routing\Session
QuidPHP/Routing testsuite can be run by creating a new QuidPHP/Assert project.
quidphp/routing 适用场景与选型建议
quidphp/routing 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 209 次下载、GitHub Stars 达 4, 最近一次更新时间为 2019 年 08 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php-framework」 「quid」 「quidphp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 quidphp/routing 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 quidphp/routing 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 quidphp/routing 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A lightweight, secure-by-default PHP microframework built on Slim – providing Laravel-like features (ORM, authentication, migrations, caching) without the bloat. Perfect for building REST APIs and small-to-medium PHP applications.
A PHP nano framework for REST API's & Micro-Services
The Core Framework for MightyPHP Framework
PHP library that provides a set of base objects and collections
PHP library that provides database access and a comprehensive ORM
PHP library that provides an extendable platform to create dynamic applications
统计信息
- 总下载量: 209
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-27