m1guelpf/ghost-api

PHP Client for the Ghost Content API

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

This package is auto-updated.

Last update: 2024-12-14 06:01:06 UTC


README

Latest Version on Packagist Software License Build Status Total Downloads

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.