php-extended / php-api-endpoint-object
此包已被废弃,不再维护。作者建议使用 php-extended/php-reifier-object 包代替。
实现 php-extended/php-api-endpoint-interface 库的库
6.1.1
2023-08-13 08:36 UTC
Requires
Requires (Dev)
This package is auto-updated.
Last update: 2023-08-13 11:44:10 UTC
README
实现 php-extended/php-api-endpoint-interface 库的库。
安装
此库的安装通过 composer 进行,所有类的自动加载通过其自动加载器完成。
- 从 他们的网站 下载
composer.phar
。 - 然后运行以下命令将此库作为依赖项安装
php composer.phar require php-extended/php-api-endpoint-object ^6
基本用法
此库是为了扩展而设计的。基础 Endpoint 实现是一个通用的对象,旨在简化转换为真正有用的端点,例如
use PhpExtended\Endpoint\Endpoint;
class MyEndpoint extends Endpoint
{
public function getFoo() : Foo
{
return $this->getObject(Foo::class, $this->getDataProvider());
}
}
其中 getDataProvider()
是一个返回数据提供者(从文件(csv、json、yaml等)或网络(json api、rest api、xml、解析的 html 等,甚至语义格式等)获取原始数据)的方法。
许可证
MIT(见 许可证文件)。