Download the PHP package maximilianradons/laravel-strapi without Composer
On this page you can find all versions of the php package maximilianradons/laravel-strapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maximilianradons/laravel-strapi
More information about maximilianradons/laravel-strapi
Files in maximilianradons/laravel-strapi
Package laravel-strapi
Short Description Laravel wrapper for using the Strapi headless CMS
License MIT
Homepage https://github.com/MaximilianRadons/laravel-strapi
Informations about the package laravel-strapi
Laravel wrapper for using the Strapi V4 headless CMS
This repository is fork of dbfx/laravel-strapi, credits goes to Dave Blakey and BBWMC.
Laravel-Strapi is a Laravel helper for using the Strapi V4 headless CMS.
Installation
You can install the package via composer:
You can publish and run the migrations with:
You can publish the config file with:
You need to define your STRAPI_URL (without /api path) and STRAPI_CACHE_TIME in .env:
Athorization (optional)
Create a bearer token in your admin panel and add it to your .env:
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:
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
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.
There are several useful options available as well.
- and allow you to specify the key to sort on and the direction
- will automatically add your STRAPI_URL to the front of any relative URLs (e.g. images, etc).
- sets how many items you are requesting
- is the offset to be used with limit, useful for pagination
You may also access Single Type items as follows:
And you may select entries by searching for a custom field (e.g. slug):
Populate with deep relations:
Deeply populate a dynamic zone with 2 components, examples from Strapi API Docs:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
- Dave Blakey
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-strapi with dependencies
laravel/framework Version ^8
spatie/laravel-package-tools Version ^1.4.3
illuminate/contracts Version ^8.37