innmind / rest-client-bundle
此包已被废弃,不再维护。未建议替代包。
用于消费REST API的库
4.0.0
2017-10-06 05:32 UTC
Requires
- php: ~7.1
- innmind/filesystem: ~3.0
- innmind/rest-client: ~6.0
- symfony/config: ~3.0
- symfony/dependency-injection: ~3.0
- symfony/http-kernel: ~3.0
- symfony/yaml: ~3.0
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2022-02-01 13:03:16 UTC
README
master |
develop |
---|---|
安装
composer require innmind/rest-client-bundle
通过在项目的app/AppKernel.php中添加以下行来启用此包:
// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Innmind\Rest\ClientBundle\InnmindRestClientBundle, ); // ... } // ... }
然后您需要指定应用程序中允许的类型,以下是一个示例:
innmind_rest_client: content_type: json: priority: 0 media_types: application/json: 0
用法
$container ->get('innmind_rest_client') ->server('http://example.com/') ->capabilities() ->names();
此示例将返回通过http://example.com/ API提供的所有资源。
然后您可以在任何服务器上访问以下方法: all
,read
,create
,update
和 remove
。查看接口了解如何使用这些方法。