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

ActiveLibrary[API Development](/categories/api)

dgural/laravel-strapi
=====================

Elegant Laravel integration for Strapi CMS with model-based API access

21↓100%PHP

Since Mar 18Pushed 1mo agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Strapi
==============

[](#laravel-strapi)

A Laravel package for integrating with **Strapi 5** CMS using an Eloquent-like model layer.

Instead of manually calling HTTP endpoints, you define model classes that map to Strapi content types and query them with a fluent builder — the same way you would with Eloquent.

> **Requires:** PHP 8.3+, Laravel 11+, Strapi 5

---

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

[](#installation)

```
composer require dgural/laravel-strapi
```

The service provider is registered automatically via Laravel's package auto-discovery. If you have disabled auto-discovery, add it manually to `bootstrap/providers.php`:

```
return [
    // ...
    DGCode\Strapi\StrapiServiceProvider::class,
];
```

Publish the config file:

```
php artisan vendor:publish --tag=strapi-config
```

This creates `config/strapi.php` in your application. Add the following to your `.env`:

```
STRAPI_BASE_URL=https://your-strapi-url.com
STRAPI_TOKEN=your-api-token

# Optional caching
STRAPI_CACHE_ACTIVE=true
STRAPI_CACHE_TTL=3600
```

---

Defining Models
---------------

[](#defining-models)

Generate a model with Artisan:

```
# Collection Type (default)
php artisan make:strapi-model Post

# Single Type
php artisan make:strapi-model Homepage --single
```

This creates `app/Strapi/Models/Post.php`:

```
