PHPackages                             messerli90/laravel-ghost - 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. messerli90/laravel-ghost

ActiveLibrary[API Development](/categories/api)

messerli90/laravel-ghost
========================

Fluent Laravel wrapper for the Ghost Content API

0.1.0(5y ago)661MITPHPPHP ^7.4|^8.0

Since Apr 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/messerli90/laravel-ghost)[ Packagist](https://packagist.org/packages/messerli90/laravel-ghost)[ Docs](https://github.com/messerli90/laravel-ghost)[ GitHub Sponsors](https://github.com/messerli90)[ RSS](/packages/messerli90-laravel-ghost/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

[![Laravel Ghost Banner](https://camo.githubusercontent.com/75f4a571c7f4566b2f69a5fe39fc7d6b1186a372388bbf6406fe053bec3ac261/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c25323047686f73742e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6d65737365726c6939302532466c61726176656c2d67686f7374267061747465726e3d617263686974656374267374796c653d7374796c655f32266465736372697074696f6e3d4272696e672b796f75722b47686f73742b626c6f672b746f2b4c61726176656c266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667267769647468733d34303026686569676874733d6175746f)](https://camo.githubusercontent.com/75f4a571c7f4566b2f69a5fe39fc7d6b1186a372388bbf6406fe053bec3ac261/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c25323047686f73742e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6d65737365726c6939302532466c61726176656c2d67686f7374267061747465726e3d617263686974656374267374796c653d7374796c655f32266465736372697074696f6e3d4272696e672b796f75722b47686f73742b626c6f672b746f2b4c61726176656c266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667267769647468733d34303026686569676874733d6175746f)

Laravel wrapper for the Ghost blogging API
==========================================

[](#laravel-wrapper-for-the-ghost-blogging-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f480160efea14cbfe5166fe74dc39956c8f3075c6b48a6beff77613b35568ce3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d65737365726c6939302f6c61726176656c2d67686f73742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/messerli90/laravel-ghost)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b473adfec0d690b0a32e87025162a46f489620fc9904514e86003fa26b705eaa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d65737365726c6939302f6c61726176656c2d67686f73742f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/messerli90/laravel-ghost/actions?query=workflow%3ATests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3abebd6a79484f07195ee21dcdae5496f10d89bb4a913ecaee7d5a0214fcd2e0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d65737365726c6939302f6c61726176656c2d67686f73742f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/messerli90/laravel-ghost/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/6ae10922183b37f2d9deb954afcafe9e9de2f5e06aa955bd491ee959576c505d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d65737365726c6939302f6c61726176656c2d67686f73742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/messerli90/laravel-ghost)

A fluent wrapper for the [Ghost Content API](https://ghost.org/docs/content-api/)

Example
-------

[](#example)

```
$post = Ghost::posts()->with('authors')->fromSlug('welcome');

$tags = Ghost::tags()->all();
```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require messerli90/laravel-ghost
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Messerli90\Ghost\GhostServiceProvider" --tag="ghost-config"
```

This is the contents of the published config file:

```
return [
    /**
     * The API version of your Ghost blog
     *
     * Read about Ghost API Versioning in their docs:
     * https://ghost.org/docs/faq/api-versioning/
     */
    'ghost_api_version' => env("GHOST_API_VERSION", 4),

    /**
     * Your admin domain can be different to your main domain.
     * All Ghost(Pro) blogs have a `.ghost.io` domain
     * as their admin domain and require https.
     */
    'admin_domain' => env('GHOST_ADMIN_DOMAIN', "https://{admin_domain}"),

    /**
     * The Content API URL and key can be obtained by creating a new
     * Custom Integration under the Integrations screen in Ghost Admin.
     */
    'key' => env('GHOST_API_KEY', ''),

    /**
     * Optionally, cache records when they are returned.
     */
    'cache' => [
        /**
         * Cache returned records
         * Set to false if you want to handle caching yourself
         */
        'cache_records' => false,

        /**
         * Prefix key used to save to cache
         * Ex. ghost_posts
         */
        'cache_prefix' => 'ghost_',

        /**
         * How long until cache expires
         * Accepts int in seconds, or DateTime instance
         */
        'ttl' => 60 * 60,
    ]
];
```

Usage
-----

[](#usage)

```
// Using the facade
Ghost::posts()->all();

// or
$ghost = new Ghost($content_key, $domain, string $version);
$ghost->posts()->all();
```

The API for `posts`, `authors`, `tags`, and `pages` is similiar and can be used with the following methods:

```
// All resources returned as an array
Ghost::posts()->all();
Ghost::authors()->all();
Ghost::tags()->all();
Ghost::pages()->all();

// Retrieve a single resource by slug
Ghost::posts()->bySlug('welcome');

// Retrieve a single resource by id
Ghost::posts()->find('605360bbce93e1003bd6ddd6');

// Get full response from Ghost Content API including meta & pagination
Ghost::posts()->paginate();
$response = Ghost::posts()->paginate(15);

$posts = $response['posts'];
$meta = $response['meta'];
```

Build your request

```
Ghost::posts()
    ->with('authors', 'tags')
    ->fields('title', 'slug', 'html')
    ->limit(20)
    ->page(2)
    ->orderBy('title')
    ->get();
```

Caching
-------

[](#caching)

It is recommended you cache your returned resources when serving from your Laravel app.

For example, a possible `BlogController@index` could look like:

```
public function index()
{
    $posts = Cache::rememberForever('posts',
        fn() => Ghost::posts()->with('authors', 'tags')->all()
    );
    return view('blog.index', compact('posts'));
}
```

#### Automatic Resource Caching (Experimental &amp; not in stable release)

[](#automatic-resource-caching-experimental--not-in-stable-release)

Automatically cache returned records for a defined time.

Includes `ghost:cache` artisan command that can be scheduled to periodically repopulate cache with new posts.

Testing
-------

[](#testing)

```
composer test
```

Roadmap
-------

[](#roadmap)

- Caching
- Ghost Content Filter

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Michael Messerli](https://github.com/messerli90)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

1860d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c5610c036d16dc5e1119c90d937e70f9cbf605d823abb3ff30dd1cf5faf910a2?d=identicon)[messerli90](/maintainers/messerli90)

---

Top Contributors

[![messerli90](https://avatars.githubusercontent.com/u/3306651?v=4)](https://github.com/messerli90 "messerli90 (15 commits)")

---

Tags

laravel-ghostmesserli90

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/messerli90-laravel-ghost/health.svg)

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

###  Alternatives

[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[spatie/laravel-rdap

Perform RDAP queries in a Laravel app

72108.3k2](/packages/spatie-laravel-rdap)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)[freshbitsweb/laravel-google-analytics-4-measurement-protocol

A Laravel package to use Measurement Protocol for Google Analytics 4

20111.0k](/packages/freshbitsweb-laravel-google-analytics-4-measurement-protocol)[spatie/spatie-price-api

The Price API used at promotional sites for our own products

1515.1k1](/packages/spatie-spatie-price-api)

PHPackages © 2026

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