m1guelpf/ghost-api

Ghost内容API的PHP客户端

v1.1.1 2021-02-13 21:10 UTC

This package is auto-updated.

Last update: 2024-09-14 05:26:54 UTC


README

Latest Version on Packagist Software License Build Status Total Downloads

此包简化了与Ghost内容API的交互。

要求

此包需要PHP >= 5.5。

安装

您可以通过composer安装此包

composer require m1guelpf/ghost-api

用法

您必须在M1guelpf\GhostAPI\Ghost构造函数中传递Guzzle客户端和API令牌。

$ghost = new \M1guelpf\GhostAPI\Ghost('YOUR_API_TOKEN');

或者,您可以跳过令牌,稍后使用connect()方法

$ghost = new \M1guelpf\GhostAPI\Ghost();

$ghost->connect('YOUR_GHOST_API_TOKEN');

帖子

$ghost->getPosts($include, $fields, $filter, $limit, $page, $order, $format);

$ghost->getPost($id);

$ghost->getPostBySlug($slug);

页面

$ghost->getPages($include, $fields, $filter, $limit, $page, $order, $format);

$ghost->getPage($id);

$ghost->getPageBySlug($slug);

作者

$ghost->getAuthors($include, $fields, $filter, $limit, $page, $order);

$ghost->getAuthor($id);

$ghost->getAuthorBySlug($slug);

标签

$ghost->getTags($include, $fields, $filter, $limit, $page, $order);

$ghost->getTag($id);

$ghost->getTagBySlug($slug);

获取Guzzle客户端

$ghost->getClient();

设置Guzzle客户端

$client = new \GuzzleHttp\Client(); // Example Guzzle client
$ghost->setClient($client);

其中 $client 是 \GuzzleHttp\Client 的一个实例。

变更日志

有关最近更改的更多信息,请参阅CHANGELOG

测试

$ composer test

贡献

有关详细信息,请参阅CONTRIBUTING

安全性

如果您发现任何安全相关的问题,请通过soy@miguelpiedrafita.com发送电子邮件,而不是使用问题跟踪器。

致谢

许可

MIT许可证。请参阅许可文件以获取更多信息。