LaravelPackages.net
Acme Inc.
Toggle sidebar
wayhood/hyperf-laravel

A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.

179
0
About wayhood/hyperf-laravel

wayhood/hyperf-laravel is a Laravel package for a coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.. It currently has 0 GitHub stars and 179 downloads on Packagist. Install it with composer require wayhood/hyperf-laravel. Discover more Laravel packages by wayhood or browse all Laravel packages to compare alternatives.

Last updated

hyperf-laravel

适配laravel,

环境

php8+

安装 使用php8

composer require wayhood/hyperf-laravel

适配

Hyperf\HttpServer\Request Hyperf\HttpServer\Contract\RequestInterface

增加 only / get 方法 与 laravel用法一致

路由适配

hyperf 原来路由

参数定义:(定义了参数后url上的路径必须以 / 结尾,否则不能访问)
    - {id}:必选
    - [{id}]:选填

修改 通过 aop切面重写 路由收集器以适配没有 / 时也可以访问

示例

Route::get('/api/test/{a}/{b}/[{c}]', function($a, $b, $c=null) {
    var_dump($a, $b, $c);
});

请求

  • http://localhost:9501/api/test/a/b/c is ok
  • http://localhost:9501/api/test/a/b/ is ok
  • http://localhost:9501/api/test/a/b is ok 默认hyperf不支持
Comments