Skip to content

A PHP API client for the Ghost v2 Content API

License

Notifications You must be signed in to change notification settings

howToCodeWell/php-ghost-api

 
 

Repository files navigation

PHP Ghost API Client

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.

About

A PHP API client for the Ghost v2 Content API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%