m1guelpf / ghost-api
PHP Client for the Ghost Content API
Fund package maintenance!
m1guelpf
Requires
- php: ^5.5|^7.0
- guzzlehttp/guzzle: ^6.1|^7.2
Requires (Dev)
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-11-14 05:54:49 UTC
README
This package makes it easy to interact with the Ghost Content API.
Requirements
This package requires PHP >= 5.5.
Installation
You can install the package via composer:
composer require m1guelpf/ghost-api
Usage
You must pass a Guzzle client and the API token to the constructor of M1guelpf\GhostAPI\Ghost
.
$ghost = new \M1guelpf\GhostAPI\Ghost('YOUR_API_TOKEN');
or you can skip the token and use the connect()
method later
$ghost = new \M1guelpf\GhostAPI\Ghost(); $ghost->connect('YOUR_GHOST_API_TOKEN');
Posts
$ghost->getPosts($include, $fields, $filter, $limit, $page, $order, $format); $ghost->getPost($id); $ghost->getPostBySlug($slug);
Pages
$ghost->getPages($include, $fields, $filter, $limit, $page, $order, $format); $ghost->getPage($id); $ghost->getPageBySlug($slug);
Authors
$ghost->getAuthors($include, $fields, $filter, $limit, $page, $order); $ghost->getAuthor($id); $ghost->getAuthorBySlug($slug);
Tags
$ghost->getTags($include, $fields, $filter, $limit, $page, $order); $ghost->getTag($id); $ghost->getTagBySlug($slug);
Get the Guzzle Client
$ghost->getClient();
Set the Guzzle Client
$client = new \GuzzleHttp\Client(); // Example Guzzle client $ghost->setClient($client);
where $client is an instance of \GuzzleHttp\Client
.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email soy@miguelpiedrafita.com instead of using the issue tracker.
Credits
License
The MIT License. Please see License File for more information.