Download the PHP package dbfx/laravel-strapi without Composer
On this page you can find all versions of the php package dbfx/laravel-strapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dbfx/laravel-strapi
More information about dbfx/laravel-strapi
Files in dbfx/laravel-strapi
Package laravel-strapi
Short Description Laravel wrapper for using the Strapi headless CMS
License MIT
Homepage https://github.com/dbfx/laravel-strapi
Informations about the package laravel-strapi
Laravel wrapper for using the Strapi headless CMS
Laravel-Strapi is a Laravel helper for using the Strapi headless CMS.
Note: for Strapi v3 support use version 2.x.x
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 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.
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
- is an array containing the fields to populate
- is an array of additional key-value pairs to add to the query string
You may also access Single Type items as follows:
And you may select entries by searching for a custom field (e.g. slug):
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
illuminate/contracts Version ^8.37 || ^9.0 || ^10
laravel/framework Version ^8 || ^9 || ^10
spatie/laravel-package-tools Version ^1.4.3