Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ワードプレスの記事を取得する継承クラス
<?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