定制 switon/router 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

switon/router

Composer 安装命令:

composer require switon/router

包简介

Attribute-discovered routes, route tables, and literal and dynamic path matching for Switon Framework

README 文档

README

CI PHP 8.3+

Switon's route matcher for literal and dynamic paths, attribute discovery, prefix-aware matching, and route resolution events.

Highlights

  • Attribute-based routing: controllers and actions declare routes in place with #[RequestMapping] and method mappings.
  • Prefix-aware discovery: controller prefixes can be derived from names or set explicitly.
  • Path mapping rules: '', relative, absolute, and array paths all map cleanly to routes.
  • View mappings: #[ViewGetMapping] and related attributes can add GET views beside write actions.
  • Fast route lookup: literal routes stay in hash lookups while dynamic ones compile to regex.
  • Match visibility: RouteNotFound and RouteParamsResolved expose misses and parameter resolution.

Installation

composer require switon/router

Quick Start

use Switon\Routing\Attribute\GetMapping;
use Switon\Routing\Attribute\RequestMapping;

#[RequestMapping('/user')]
class UserController
{
    #[GetMapping('{id}')]
    public function showAction(int $id): array
    {
        return ['id' => $id];
    }
}

Docs: https://docs.switon.dev/latest/router

License

MIT.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固