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

ActiveLibrary[API Development](/categories/api)

kamil-malinski/laravel-strapi
=============================

Laravel wrapper for using the Strapi headless CMS

v2.0.5(4y ago)05MITPHPPHP ^7.3|^7.4|^8.0|^8.1

Since Apr 27Pushed 4y agoCompare

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

READMEChangelog (1)Dependencies (9)Versions (21)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 [MaximilianRadons/laravel-strapi](https://github.com/MaximilianRadons/laravel-strapi), credits goes to [Dave Blakey](https://github.com/dbfx), [BBWMC](https://github.com/bbwmc) and [MaximilianRadons](https://github.com/MaximilianRadons).

---

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

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

[](#installation)

You can install the package via composer:

```
composer require kamil-malinski/laravel-strapi
```

You can publish and run the migrations with:

You can publish the config file with:

```
php artisan vendor:publish --provider="KamilMalinski\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

```

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 KamilMalinski\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 KamilMalinski\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 KamilMalinski\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 KamilMalinski\LaravelStrapi\LaravelStrapi;

$strapi = new LaravelStrapi();

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

Populate with deep relations:

```
use KamilMalinski\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 KamilMalinski\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

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 52.1% 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 ~16 days

Recently: every ~9 days

Total

20

Last Release

1576d 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://avatars.githubusercontent.com/u/68733431?v=4)[kamil-malinski](/maintainers/kamil-malinski)[@kamil-malinski](https://github.com/kamil-malinski)

---

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 (15 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)")[![kamil-malinski](https://avatars.githubusercontent.com/u/68733431?v=4)](https://github.com/kamil-malinski "kamil-malinski (4 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/kamil-malinski-laravel-strapi/health.svg)

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

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M97](/packages/dedoc-scramble)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M46](/packages/spatie-laravel-pdf)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[lettermint/lettermint-laravel

Official Lettermint driver for Laravel

1190.2k1](/packages/lettermint-lettermint-laravel)[dbfx/laravel-strapi

Laravel wrapper for using the Strapi headless CMS

5035.2k](/packages/dbfx-laravel-strapi)

PHPackages © 2026

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