php-extended / php-api-endpoint-http-object
此包已废弃,不再维护。作者建议使用php-extended/php-reifier-object包。
php-extended/php-api-endpoint-http-interface 库的实现
6.1.0
2023-08-13 13:35 UTC
Requires
Requires (Dev)
- dev-master
- 6.1.0
- 6.0.4
- 6.0.3
- 6.0.2
- 6.0.1
- 6.0.0
- 5.0.1
- 5.0.0
- 4.0.2
- 4.0.1
- 4.0.0
- 3.2.23
- 3.2.22
- 3.2.21
- 3.2.20
- 3.2.19
- 3.2.18
- 3.2.17
- 3.2.16
- 3.2.15
- 3.2.14
- 3.2.13
- 3.2.12
- 3.2.11
- 3.2.10
- 3.2.9
- 3.2.8
- 3.2.7
- 3.2.6
- 3.2.5
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.7
- 3.1.6
- 3.1.5
- 3.1.4
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.14
- 3.0.13
- 3.0.12
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
This package is auto-updated.
Last update: 2023-08-18 07:59:40 UTC
README
php-extended/php-api-endpoint-http-interface 库的实现。
安装
此库的安装通过composer进行,所有类的自动加载通过其自动加载器完成。
- 从他们的网站下载
composer.phar
。 - 然后运行以下命令将此库作为依赖项安装
php composer.phar require php-extended/php-api-endpoint-http-object ^6
基本用法
此库是为了扩展而设计的。HttpEndpoint实现是一个通用的对象,旨在简化转换为真正有用的端点,可能如下所示
use PhpExtended\Endpoint\Endpoint;
class MyEndpoint extends HttpEndpoint
{
public function getFoo() : Foo
{
$stringData = $this->httpGet($this->createUri('https://example.com'));
return $this->getObject(Foo::class, new CustomDataProvider($stringData));
}
}
其中getDataProvider()
是一个返回数据提供者的方法,该数据提供者获取原始数据,无论是从文件(csv、json、yaml等)还是网络(json api、rest api、xml、解析的html等,甚至是语义格式等)
许可证
MIT(见许可证文件)。