kodeops/laravel-strapi

Strapi wrapper for Laravel.

dev-main 2023-01-05 14:11 UTC

This package is auto-updated.

Last update: 2024-04-05 16:59:07 UTC


README

 _     _  _____  ______  _______  _____   _____  _______
 |____/  |     | |     \ |______ |     | |_____] |______
 |    \_ |_____| |_____/ |______ |_____| |       ______|
 

Laravel Strapi Wrapper

This package is a wrapper to make REST API calls to Strapi.

Making a request

The REST API allows accessing the content-types through API endpoints. Strapi automatically creates API endpoints when a content-type is created. API parameters can be used when querying API endpoints to refine the results.

REST API Documentation

use kodeops\LaravelStrapi\Strapi;

$collection = 'tgam-artist';
$params = [
    'populate' => 'deep',
];
$loop_results = true;

Strapi::request($collection, $params, $loop_results);

Update a collection item:

use kodeops\LaravelStrapi\Strapi;

$collection = 'tgam-artist';
$params = [
    'data' => [
        'title' => A title for the collection item',
    ],
];

Strapi::update($collection, $params);

Create a collection item:

use kodeops\LaravelStrapi\Strapi;

$collection = 'tgam-artists';
$params = [
    'data' => [
        'title' => A title for the collection item',
        'description' => A description for the collection item',
        'url' => A url for the collection item',
    ],
];

Strapi::create($collection, $params);