承接 esase/tiny-router 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

esase/tiny-router

Composer 安装命令:

composer require esase/tiny-router

包简介

Flexible routing system component for HTTP and console applications

README 文档

README

Build Status Coverage Status

Tiny/Routing - it's a layer between the outside world like a browser or a console command CLI and your application. The package may be integrated to any existing php project and it does not require any extra packages.

Usually routing contains of two main parts:

  1. Routes - which describe a meta information like - a query, a query type, and a responsible controller which processes all incoming requests.

  2. A Router - just holds registered routes and matches incoming requests with registered routes.
    So it just returns either a matched route or trigger an Exception when a route is not found.

Current implementation of routing is very simple but in the same time very powerful. It gets you a possibility to work with it using a plain requests (literal) and Regexp based requests, also it supports filtering requests by http requests types like: GET, POST, etc.
Also you can use it as a routing for you CLI projects.

So let's check a look an http routing example:

    // create an instance of the router
    $router = new Router(new RequestHttpParams($_SERVER));

    // a literal `home` route
    $router->registerRoute(new Route(
        '/',
        'HomeController',
        'index'
    ));

    // a literal `users` route which accepts only `GET` and `POST` requests
    $router->registerRoute(new Route(
        '/users',
        'UserController',
        // list of actions
        [ 
            'GET' => 'list',
            'POST' => 'create'
        ]
    ));

    // a more complex example using a `RegExp` rule
    $router->registerRoute(new Route(
        '|^/users/(?P<id>\d+)$|i', // it's matches to: `/users/1`, `/users/300`, etc
        'UserController',
        [
            'GET' => 'view', 
            'DELETE' => 'delete',
        ],
        'regexp', 
        ['id']
    ));

    // now get a matched route 
    $matchedRoutes = $router->getMatchedRoute();

Installation

Run the following to install this library:

$ composer require esase/tiny-router

Documentation

https://tiny-docs.readthedocs.io/en/latest/tiny-router/docs/index.html

esase/tiny-router 适用场景与选型建议

esase/tiny-router 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 84 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 09 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「framework」 「routing」 「mvc」 「lightweight」 「tinyframework」 「microservices」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 esase/tiny-router 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 esase/tiny-router 我们能提供哪些服务?
定制开发 / 二次开发

基于 esase/tiny-router 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-10