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

ActiveLibrary[API Development](/categories/api)

ervinasm/laravel-strapi
=======================

Laravel wrapper for using the Strapi headless CMS

03PHP

Since Jul 5Pushed 2y agoCompare

[ Source](https://github.com/ErvinasM/laravel-strapi)[ Packagist](https://packagist.org/packages/ervinasm/laravel-strapi)[ RSS](/packages/ervinasm-laravel-strapi/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

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

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/b0ead4c1fb8c4aba038a7a4df73d425fe8a4c67197c9e085f0bddc68a94a6cda/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646266782f6c61726176656c2d7374726170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dbfx/laravel-strapi)[![GitHub Tests Action Status](https://camo.githubusercontent.com/1909d75b6702096f13049a1693dd758c9a7fd184b9d7963e36866350e65c12c8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f646266782f6c61726176656c2d7374726170692f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/dbfx/laravel-strapi/actions?query=workflow%3Arun-tests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/633356187b38d883fd647869117a237fc92ba11e09ed7f8486fb9feab4e6d646/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f646266782f6c61726176656c2d7374726170692f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/dbfx/laravel-strapi/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/acb2c07a4d8b998bf8d46746aa56147617566c1b448ffd436dc079a58adf2b87/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646266782f6c61726176656c2d7374726170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dbfx/laravel-strapi)

---

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

Note: for Strapi v3 support use version 2.x.x

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

[](#installation)

You can install the package via composer:

```
composer require dbfx/laravel-strapi
```

You can publish and run the migrations with:

You can publish the config file with:

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

You need to define your STRAPI\_URL and STRAPI\_CACHE\_TIME in .env: You can also optionally define a STRAPI\_TOKEN to enable authentication. Do not include 'Bearer' only the token itself.

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

```

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 Dbfx\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
- `$populate` is an array containing the fields to populate

```
use Dbfx\LaravelStrapi\LaravelStrapi;

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

$entry = $strapi->entry('blogs', 1, $fullUrls = true, $populate = ['author', 'images']);
```

You may also access Single Type items as follows:

```
use Dbfx\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 Dbfx\LaravelStrapi\LaravelStrapi;

$strapi = new LaravelStrapi();

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

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

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 70% 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.

### Community

Maintainers

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

---

Top Contributors

[![dbfx](https://avatars.githubusercontent.com/u/182394?v=4)](https://github.com/dbfx "dbfx (56 commits)")[![jorisdrenth](https://avatars.githubusercontent.com/u/10384146?v=4)](https://github.com/jorisdrenth "jorisdrenth (8 commits)")[![sietzekeuning](https://avatars.githubusercontent.com/u/11088108?v=4)](https://github.com/sietzekeuning "sietzekeuning (8 commits)")[![ErvinasM](https://avatars.githubusercontent.com/u/73030569?v=4)](https://github.com/ErvinasM "ErvinasM (3 commits)")[![aps74](https://avatars.githubusercontent.com/u/81538937?v=4)](https://github.com/aps74 "aps74 (1 commits)")[![VincentBean](https://avatars.githubusercontent.com/u/3906942?v=4)](https://github.com/VincentBean "VincentBean (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![kfina91](https://avatars.githubusercontent.com/u/72922128?v=4)](https://github.com/kfina91 "kfina91 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M271](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[microsoft/microsoft-graph

The Microsoft Graph SDK for PHP

65723.5M96](/packages/microsoft-microsoft-graph)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)

PHPackages © 2026

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