romadomma / example-http-client
Drom.ru 的测试任务
dev-master
2020-09-02 17:15 UTC
Requires
- php: ^7.4
- ext-json: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-09-29 05:42:51 UTC
README
用于获取评论服务的客户端 http://example.com
安装
$ composer require romadomma/example-http-client
快速入门
<?
require 'vendor/autoload.php';
use ExampleHttpClient\ExampleClient;
use ExampleHttpClient\ExampleComment;
$client = new ExampleClient();
...
$comment = new ExampleComment([
'name' => 'Roman',
'text' => 'First comment',
]);
API
获取评论
函数 $client->getComments()
返回一个包含 ExampleComment
对象的数组
添加评论
函数 $client->addComment($comment)
添加一个新的评论。它接受一个 ExampleComment
对象作为输入,并返回它。
修改评论
函数 $client->updateComment($comment)
修改现有的评论。它接受一个必须包含 id
字段的 ExampleComment
对象作为输入,并返回一个 ExampleComment
类的对象。