lack / subscription
管理微服务中的订阅
v1.2.2
2024-04-25 14:14 UTC
Requires
- php: >=8.0
- phore/http-client: *
- phore/hydrator: *
Requires (Dev)
README
服务间管理订阅的库
安装
composer install lack/subscription
添加到Brace应用
01_di.php
$app->addModule( new SubscriptionClientModule( "file:///opt/conf/", CONF_SUBSCRIPTION_CLIENT_ID, CONF_SUBSCRIPTION_CLIENT_SECRET ) );
10_middleware.php
$app->setPipe([ ... // Below RouterEvalMiddleware // Search for {subscription_id} in the route and load the subscription object new SubscriptionMiddleware(), ... ]);
使用方法
在控制器类中
The RouterEvalMiddleware will register a service subscription
in the container. You can use this service to get the subscription object.
public function loadSubscription(T_Subscritpion $subscription) { return $subscription; }