davekok / sturdy-activity
此包已被弃用且不再维护。未建议替代包。
一个组件,用于在执行活动时记录活动,并在编码时更新活动图。
v0.89
2018-12-21 14:47 UTC
Requires
- php: >=7.1.0
- psr/cache: ^1.0
- uri-template/uri-template: ^1.0
Requires (Dev)
- cache/array-adapter: ^0.5.0
- doctrine/annotations: >=1.4.0
- fzaninotto/faker: ^1.7
- php-ds/php-ds: ^1.2
- phpspec/prophecy: ~1.0
- psr/http-message: ^1.0
- symfony/http-foundation: ^3.3
This package is auto-updated.
Last update: 2022-05-29 13:56:18 UTC
README
Sturdy Activity 是一个帮助开发者编写优秀微服务的项目。目前它包含两个基本组件。HyperMedia 组件帮助开发者编写 HyperMedia API,Activity 组件旨在帮助开发者编写复杂的长运行后端活动。
目前,HyperMedia 组件状态良好且非常实用,尽管文档不足。Activity 组件仍在开发中。
HyperMedia
HyperMedia 类配备了几个适配器工厂函数。例如,如果你希望使用 Symfony 框架,你可以使用 HyperMedia::createSymfonyAdaptor 来轻松地与该框架协同工作。
示例
use Sturdy\Activity\Meta\{Field,Get,Post};
class Person
{
/**
* @Field("string required")
*/
public $name;
/**
* The get verb for this resouce.
*
* @Get
* @param OK $response the response
*/
public function get(\Sturdy\Activity\Response\OK $response): void
{
$this->name = "Patrick";
}
/**
* The post verb for this resouce.
*
* @Post
* @param OK $response the response
*/
public function post(\Sturdy\Activity\Response\OK $response): void
{
$name = $this->name; // $this->name is automatically filled from POST body
}
}
HyperMedia::createEchoAdaptor(
new MySharedStateStore(),
new MyCache(),
new MyTranslator(),
new MyJsonDeserializer(),
"MySourceUnit",
"/api/",
"MyNameSpace"
)->handle($_SERVER)->send()