uchm4n / api-client
Any API Wrapper client library
1.0.2
2021-12-03 21:03 UTC
Requires
- php: ^7.4|^8.1
- guzzlehttp/guzzle: ^7.4
- pestphp/pest: ^1.21
README
This is a JSONPlaceholder client library. It is designed to be easily integrated into any project.
Installation
composer require uchm4n/api-client
How to use
<?php require_once 'vendor/autoload.php'; use U\APIClient; $api = new APIClient(); // test getPosts $api->getPosts(); // test getPostByID $api->getPostByID(1); // test getPostWithComments $api->getPostWithComments(1); // test getCommentsByPost $api->getCommentsByPost(5); // test savePost $api->savePost([ 'title' => 'TEST SAVED', 'body' => 'TEST BODY', 'userId' => 1, ]); // test updatePost $api->updatePost([ 'id' => 1, 'title' => 'TEST UPDATED', 'body' => 'TEST BODY', 'userId' => 1, ]); // test patchPost $api->patchPost([ 'id' => 1, 'title' => 'TEST PATCHED', ]); // test deletePost $api->deletePost(5);