gadon78921 / comment-client-drom
Client to abstract comment service
1.0.2
2021-01-10 09:24 UTC
Requires
- php: >=7.4
- ext-ctype: *
- ext-iconv: *
- symfony/browser-kit: 5.2.*
- symfony/console: 5.2.*
- symfony/css-selector: 5.2.*
- symfony/dotenv: 5.2.*
- symfony/flex: ^1.3.1
- symfony/framework-bundle: 5.2.*
- symfony/http-client: 5.2.*
- symfony/phpunit-bridge: ^5.2
- symfony/yaml: 5.2.*
Conflicts
Replaces
This package is auto-updated.
Last update: 2024-11-10 17:59:41 UTC
README
Установка
composer require gadon78921/comment-client-drom
Использование
$httpClient = HttpClient::create();
$mapper = new CommentMapper();
$commentApiHttp = new CommentApiHttp($httpClient, $mapper, 'http://example.com');
$response = $commentApiHttp->list($limit, $offset);
Получить список комментариев:
$response = $commentApiHttp->list($limit, $offset);
Добавить комментарий:
$comment = new Comment();
$comment->setName('Ivan');
$comment->setText('Comment_text');
$response = $commentApiHttp->add($comment);
Обновить комментарий:
$comment = new Comment();
$comment->setId(5);
$comment->setName('Ivan');
$comment->setText('Comment_text');
$response = $commentApiHttp->update($comment);