承接 legatus/router 相关项目开发

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

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

legatus/router

Composer 安装命令:

composer require legatus/router

包简介

A fast and composable middleware router inspired in Express.js

README 文档

README

A fast and composable middleware router inspired in Express.js

Type Coverage Mutation testing badge

Installation

You can install the Router component using Composer:

composer require legatus/router

Quick Start

<?php
declare(strict_types=1);

use Legatus\Http\Router;
use Legatus\Http\RoutingContext;
use Legatus\Http\RoutingContextError;
use Psr\Http\Message\ResponseInterface as Resp;
use Psr\Http\Message\ServerRequestInterface as Req;
use function Legatus\Http\handle_func;

/**
 * @param Req $req
 * @return Resp
 * @throws RoutingContextError
 */
function show_user(Req $req): Resp {
    $id = RoutingContext::of($req)->getParam('id');
    return new Nyholm\Psr7\Response(200, [], 'Hello User ' . $id);
}

$router = new Router();
$router->get('/users/:id', handle_func('show_user'));

$request = new Nyholm\Psr7\ServerRequest('GET', '/users/1');
$response = $router->handle($request);

echo $response->getBody() . PHP_EOL; // Hello User 1

For more details you can check the online documentation here.

Project status & release process

While this library is still under development, it is well tested and should be stable enough to use in production environments.

The current releases are numbered 0.x.y. When a non-breaking change is introduced (adding new methods, optimizing existing code, etc.), y is incremented.

When a breaking change is introduced, a new 0.x version cycle is always started.

It is therefore safe to lock your project to a given release cycle, such as 0.2.*.

If you need to upgrade to a newer release cycle, check the release history for a list of changes introduced by each further 0.x.0 version.

Community

We still do not have a community channel. If you would like to help with that, you can let me know!

Contributing

Read the contributing guide to know how can you contribute to Legatus.

Security Issues

Please report security issues privately by email and give us a period of grace before disclosing.

About Legatus

Legatus is a personal open source project led by Matías Navarro Carter and developed by contributors.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固