Search by

flexacms / laravel

ivanmercedes

Laravel client for the Flexa headless CMS: fluent queries, caching and typed entries.

v0.1.0 2026-10-12 06:54 UTC

This package is auto-updated.

Last update: 2026-10-12 07:06:51 UTC


README

Laravel client for the Flexa headless CMS: fluent queries, Laravel paginators, caching and translatable values.

This repository is a read-only split of flexacms/sdk. Open issues and pull requests there.

composer require flexacms/laravel
FLEXA_URL=https://cms.example.com
FLEXA_API_KEY=flx_...
use FlexaCms\Laravel\Facades\Flexa;

$posts = Flexa::entity('posts')->published()->paginate(12); // LengthAwarePaginator of Entry

$post = Flexa::entity('posts')->findOrFail($slug); // 404 when missing

$post->title;
$post->value('headline');        // translatable values resolve to app()->getLocale()
$post->value('headline', 'en');
$post['rating'];
@foreach ($posts as $post)
    <a href="{{ route('blog.show', $post->slug) }}">{{ $post->value('headline') }}</a>
@endforeach

{{ $posts->links() }}

Queries

published(), status(), search(), category() and withRelations() filter; paginate(), all(), cursor() (lazy), find(), findOrFail() and schema() read. Queries are immutable, so a base query can be shared.

Writes need a key with the Write or Delete ability: create(), update(), delete($id, force: true) and restore(). Failures throw FlexaCms\Laravel\Exceptions\FlexaException with status and validation errors.

Cache

Reads are cached for 60 seconds (FLEXA_CACHE_TTL, 0 to disable) in the default store (FLEXA_CACHE_STORE). Per query: ->cache(3600) or ->cache(0). Clear everything with Flexa::flushCache().

php artisan vendor:publish --tag=flexa-config