Created
December 4, 2020 06:19
-
-
Save kurozumi/c4fb71170ddbfc67e2edbaa0742f3753 to your computer and use it in GitHub Desktop.
ワードプレスの記事を取得する継承クラス
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Customize\Service\WordPress; | |
use GuzzleHttp\Client; | |
abstract class AbstractService | |
{ | |
private $client; | |
public function __construct(Client $client) | |
{ | |
$this->client = $client; | |
} | |
public function getPosts() | |
{ | |
$response = $this->client->get("wp-json/wp/v2/posts"); | |
return json_decode($response->getBody(), true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment