Download the PHP package svnwa/laravel-strapi without Composer
On this page you can find all versions of the php package svnwa/laravel-strapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download svnwa/laravel-strapi
More information about svnwa/laravel-strapi
Files in svnwa/laravel-strapi
Package laravel-strapi
Short Description This package provides an implementation to consume the Strapi REST API.
License MIT
Homepage https://github.com/svnwa/laravel-strapi
Informations about the package laravel-strapi
Laravel Strapi
This package provides an implementation to consume the Strapi REST API.
The current implementation only supports fetching data from Strapi since I personally didn't have a use case to write data to it via API yet.
Currently supports Strapi v4 which is a bit different from the preceding v3 REST API.
Installation
1. Installation via Composer
2. Publishing the the config file:
3. Editing the the .env file:
The is optional.[^1]
The default value is defined in the config file at 3600 seconds (1 hour).
[^1]: Time is in seconds.
4. Optional "cache reset" route
This package also provides an optional route to automatically reset the cache with a Webhook from within Strapi e.g. after update or creation of a resource. The route can be activated in the config file. Just set the value to true:
Usage
This package attemps to make use of a fluent api similar to Laravels Eloquent:
Examples
-
Get a list of entries
-
Get an entry
Using Strapis basic API Parameters:
-
Sorting the response
Supports Strapis sorting on one or multiple fields and/or their direction
-
Page through entries
Supports Strapis pagination on results by offset
-
Supports Strapis filter results found with its "Get entries" method
-
Queries can accept a fields parameter to select only some fields.
-
Queries can accept a populate parameter to populate various field types
Populate with wildcard. If no parameter is given to the populate() method it defauls to using the wildcard operator:
or:
Tip: Strapi offers deep population for e.g. nested components and does not populate them by default. Even not with the wildcard *
Queries can accept a publicationState parameter to fetch entries based on their publication state:
-
The locale API parameter can be used to get entries from a specific locale
License
MIT. Please see the license file for more information.