friendsofhyperf/http-request-lifecycle

Hyperf 的 HTTP 请求生命周期组件。


README

Latest Stable Version Total Downloads License

Hyperf 的 HTTP 请求生命周期组件。此功能已被合并到官方仓库(hyperf/http-server, #5715)。

安装

composer require friendsofhyperf/http-request-lifecycle

用法

<?php
namespace App\Listener;

use FriendsOfHyperf\Http\RequestLifeCycle\Events\RequestHandled;
use Hyperf\Event\Annotation\Listener;
use Hyperf\Event\Contract\ListenerInterface;

#[Listener]
class RequestHandledListener implements ListenerInterface
{
    public function listen(): array
    {
        return [
            RequestHandled::class,
        ];
    }

    /**
     * @param RequestHandled $event
     */
    public function process(object $event)
    {
        var_dump($event);
    }
}

事件

  • RequestReceived
  • RequestHandled
  • RequestTerminated

赞助商

如果你喜欢这个项目,请买我一杯咖啡。[ 支付宝 | 微信支付 ]