PHPackages                             srg/ghost-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. srg/ghost-api

ActiveLibrary[API Development](/categories/api)

srg/ghost-api
=============

PHP wrapper for Ghost CMS/publishing platform API

v1.0.1(4y ago)045MITPHPCI failing

Since May 19Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ser-gi-o/ghost-api)[ Packagist](https://packagist.org/packages/srg/ghost-api)[ RSS](/packages/srg-ghost-api/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

PHP API for TryGhost/Ghost
==========================

[](#php-api-for-tryghostghost)

PHP wrapper for Ghost CMS/publishing platform API

Ghost Content API &amp; Ghost Admin API
---------------------------------------

[](#ghost-content-api--ghost-admin-api)

PHP wrapper matches the same signatures as the Javascript SDK for GhostContentAPI and GhostAdminAPI

### Setup

[](#setup)

Follow Ghost directions for custom integration.

Add generated keys to .env

```
GHOST_CONTENT_KEY=
GHOST_ADMIN_KEY=
GHOST_URL=
GHOST_VERSION=
```

Add to Laravel config/services.php

```
'ghost' => [
   'content_key' => env('GHOST_CONTENT_KEY'),
   'admin_key'   => env('GHOST_ADMIN_KEY'),
   'url'         => env('GHOST_URL'),
   'version'     => env('GHOST_VERSION'),
],
```

### How to Use

[](#how-to-use)

**GhostContentAPI:**

```
    $config = [
    'url'    => config('services.ghost.url'),
    'key'    => config('services.ghost.content_key'),
    'version'=> config('services.ghost.version'),
    ];

    $api = new GhostContentAPI($config);

    $rs = [];  //hold results

    // Browsing posts returns Promise([Post...]);
    // The resolved array will have a meta property
    $rs[] = $api->posts->browse(['limit' => 2, 'include' => 'tags,authors']);
    $rs[] = $api->posts->browse();

    // Reading posts returns Promise(Post);
    $rs[] = $api->posts->read(['id' => 'abcd1234']);
    $rs[] = $api->posts->read(['slug' => 'something'], ['formats' => ['html', 'plaintext']]);

    // Browsing authors returns Promise([Author...])
    // The resolved array will have a meta property
    $rs[] = $api->authors->browse(['page' => 2]);
    $rs[] = $api->authors->browse();

    // Reading authors returns Promise(Author);
    $rs[] = $api->authors->read(['id' => 'abcd1234']);
    // include can be array for any of these
    $rs[] = $api->authors->read(['slug' => 'something'], ['include' => 'count.posts']);

    // Browsing tags returns Promise([Tag...])
    // The resolved array will have a meta property
    $rs[] = $api->tags->browse(['order' => 'slug ASC']);
    $rs[] = $api->tags->browse();

    // Reading tags returns Promise(Tag);
    $rs[] = $api->tags->read(['id' => 'abcd1234']);
    $rs[] = $api->tags->read(['slug' => 'something'], ['include' => 'count.posts']);

    // Browsing pages returns Promise([Page...])
    // The resolved array will have a meta property
    $rs[] = $api->pages->browse(['limit' => 2]);
    $rs[] = $api->pages->browse();

    // Reading pages returns Promise(Page);
    $rs[] = $api->pages->read(['id' => 'abcd1234']);
    $rs[] = $api->pages->read(['slug' => 'something', 'fields' => ['title']]);

    // Browsing settings returns Promise(Settings...)
    // The resolved object has each setting as a key value pair
    $rs[] = $api->settings->browse();

    //output
    dump($rs);
```

**GhostAdminAPI:**

```
    $config = [
    'url'    => config('services.ghost.url'),
    'key'    => config('services.ghost.admin_key'),
    'version'=> config('services.ghost.version'),
    ];

    $api = new GhostAdminAPI($config);

    $rs = []; //hold results
    $rs[] = $api->posts->browse();
    $rs[] = $api->posts->read(['id' => 'abcd1234']);
    $rs[] = $api->posts->delete(['id' => 'abcd1234']);

    //todo:
    //$rs[] = $api->posts->add(['title' => 'My first API post']);
    //todo:
    //$rs[] = $api->pages->edit(['id'   => 'abcd1234', 'title' => 'Renamed  my post']);

    //output
    dump($rs);
```

All functions follow the same signature as the TryGhost Javascript SDK and parameters work the same as the Ghost documentation.

**Ghost API**

-
- Ghost Javascript documentation:

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~506 days

Total

2

Last Release

1729d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4f25a0277c9f9d018e0ccc1fdbdf9d7920f8f4040ac935484a7ea8ca583b14bf?d=identicon)[srg](/maintainers/srg)

---

Top Contributors

[![ser-gi-o](https://avatars.githubusercontent.com/u/7634076?v=4)](https://github.com/ser-gi-o "ser-gi-o (8 commits)")

---

Tags

ghost-apighost-contentghost-php-wrapperlaravel-ghostlaravel-ghost-api

### Embed Badge

![Health badge](/badges/srg-ghost-api/health.svg)

```
[![Health](https://phpackages.com/badges/srg-ghost-api/health.svg)](https://phpackages.com/packages/srg-ghost-api)
```

###  Alternatives

[google/apiclient

Client library for Google APIs

9.8k205.9M1.1k](/packages/google-apiclient)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k42](/packages/civicrm-civicrm-core)[plivo/plivo-php

A PHP SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML

1143.1M19](/packages/plivo-plivo-php)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)[plivo/php-sdk

A PHP SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML

1112.0M6](/packages/plivo-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
