PHPackages                             maximilianradons/laravel-strapi - 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. maximilianradons/laravel-strapi

ActiveLibrary[API Development](/categories/api)

maximilianradons/laravel-strapi
===============================

Laravel wrapper for using the Strapi headless CMS

v2.0.4(4y ago)0652[1 PRs](https://github.com/MaximilianRadons/laravel-strapi/pulls)MITPHPPHP ^7.3|^7.4|^8.0|^8.1

Since Apr 27Pushed 2y agoCompare

[ Source](https://github.com/MaximilianRadons/laravel-strapi)[ Packagist](https://packagist.org/packages/maximilianradons/laravel-strapi)[ Docs](https://github.com/MaximilianRadons/laravel-strapi)[ GitHub Sponsors](https://github.com/bbwmc)[ RSS](/packages/maximilianradons-laravel-strapi/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (9)Versions (20)Used By (0)

Laravel wrapper for using the Strapi V4 headless CMS
====================================================

[](#laravel-wrapper-for-using-the-strapi-v4-headless-cms)

This repository is fork of [dbfx/laravel-strapi](https://github.com/dbfx/laravel-strapi), credits goes to [Dave Blakey](https://github.com/dbfx) and [BBWMC](https://github.com/bbwmc).

---

Laravel-Strapi is a Laravel helper for using the Strapi V4 headless CMS.

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

[](#installation)

You can install the package via composer:

```
composer require maximilianradons/laravel-strapi
```

You can publish and run the migrations with:

You can publish the config file with:

```
php artisan vendor:publish --provider="MaximilianRadons\LaravelStrapi\LaravelStrapiServiceProvider" --tag="strapi-config"
```

You need to define your STRAPI\_URL (without /api path) and STRAPI\_CACHE\_TIME in .env:

```
STRAPI_URL=https://strapi.test.com
STRAPI_CACHE_TIME=3600

```

### Athorization (optional)

[](#athorization-optional)

Create a bearer token in your admin panel and add it to your .env:

```
STRAPI_API_TOKEN=your_api_token

```

### Cache Flushing (optional)

[](#cache-flushing-optional)

To flush the strapi cache on content update, you need to create a Webhook in the Strapi admin panel. Setup a url and a header with Key "Athorization" and a random string as Value and add them to your .env:

```
STRAPI_WEBHOOK_URL=http://localhost:8000/strapi-cache-webhook
STRAPI_WEBHOOK_SIGNATURE=your_random_string
STRAPI_CLEAR_CACHE_ON_WEBHOOK=true //default true

```

In your App you can use the StrapiWebhook Event to implement your own Logic to flush the cash if needed. Add an Event Listener to your App, you also need to register the Listener in your EventServiceProvider.

Usage
-----

[](#usage)

laravel-strapi provides the collection() and entry() calls to return a full collection, or a specific entry from a collection. In the example below we are querying the strapi collection 'blogs' and then getting the entry with id 1 from that collection.

```
use MaximilianRadons\LaravelStrapi\LaravelStrapi;

$strapi = new LaravelStrapi();
$blogs = $strapi->collection('blogs');
$entry = $strapi->entry('blogs', 1);
```

There are several useful options available as well.

- `$sortKey` and `$sortOrder` allow you to specify the key to sort on and the direction
- `$fullUrls` will automatically add your STRAPI\_URL to the front of any relative URLs (e.g. images, etc).
- `$limit` sets how many items you are requesting
- `$start` is the offset to be used with limit, useful for pagination

```
use MaximilianRadons\LaravelStrapi\LaravelStrapi;

$strapi = new LaravelStrapi();
$blogs = $strapi->collection('blogs', $sortKey = 'id', $sortOrder = 'DESC', $limit = 20, $start = 0, $fullUrls = true);

$entry = $strapi->entry('blogs', 1, $fullUrls = true);
```

You may also access Single Type items as follows:

```
use MaximilianRadons\LaravelStrapi\LaravelStrapi;

$strapi = new LaravelStrapi();

// Fetch the full homepage array
$homepageArray = $strapi->single('homepage');

// Return just the ['content'] field from the homepage array
$homepageItem = $strapi->single('homepage', 'content');
```

And you may select entries by searching for a custom field (e.g. slug):

```
use MaximilianRadons\LaravelStrapi\LaravelStrapi;

$strapi = new LaravelStrapi();

$entries = $strapi->entriesByField('blogs', 'slug', 'test-blog-post');
```

Populate with deep relations:

```
use MaximilianRadons\LaravelStrapi\LaravelStrapi;

$strapi = new LaravelStrapi();

// load all relations one Level deep
$homepageArray = $strapi->populate(['*'])->single('homepage');

// 2 Level or deeper example
$homepageArray = $strapi->populate(['homepage.navbar.links', 'homepage.metadata'])->single('homepage');
```

Deeply populate a dynamic zone with 2 components, examples from [Strapi API Docs](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#component-dynamic-zones):

```
use MaximilianRadons\LaravelStrapi\LaravelStrapi;

$strapi = new LaravelStrapi();

$query = [
    'populate' => [
        'testDZ' => [
            'populate' => '*'
        ],
    ]
];

$homepageArray = $strapi->query($query)->single('articels');

$query = [
    'fields' => ['title', 'slug'],
    'populate' => [
        'headerImage' => [
            'fields' => ['name', 'url']
        ],
    ]
];

$homepageArray = $strapi->query($query)->single('articels');
```

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.

Credits
-------

[](#credits)

- [Dave Blakey](https://github.com/dbfx)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~16 days

Recently: every ~5 days

Total

19

Last Release

1542d ago

Major Versions

v1.1.1 → v2.0.02022-02-01

PHP version history (2 changes)v1.0.0PHP ^7.3|^7.4|^8.0

v1.1.0PHP ^7.3|^7.4|^8.0|^8.1

### Community

Maintainers

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

---

Top Contributors

[![dbfx](https://avatars.githubusercontent.com/u/182394?v=4)](https://github.com/dbfx "dbfx (38 commits)")[![MaximilianRadons](https://avatars.githubusercontent.com/u/28896093?v=4)](https://github.com/MaximilianRadons "MaximilianRadons (25 commits)")[![sietzekeuning](https://avatars.githubusercontent.com/u/11088108?v=4)](https://github.com/sietzekeuning "sietzekeuning (8 commits)")[![ed-bbwmc](https://avatars.githubusercontent.com/u/83449957?v=4)](https://github.com/ed-bbwmc "ed-bbwmc (6 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![VincentBean](https://avatars.githubusercontent.com/u/3906942?v=4)](https://github.com/VincentBean "VincentBean (1 commits)")

---

Tags

laravellaravel-packagestrapilaravel-strapistrapi-cms

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/maximilianradons-laravel-strapi/health.svg)

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

###  Alternatives

[dbfx/laravel-strapi

Laravel wrapper for using the Strapi headless CMS

5032.3k](/packages/dbfx-laravel-strapi)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)[njoguamos/laravel-plausible

A laravel package for interacting with plausible analytics api.

208.8k](/packages/njoguamos-laravel-plausible)

PHPackages © 2026

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