whitecube/laravel-flexible-content

Base library for repeated layout fields, content builders and other collection components
1,747 5
Install
composer require whitecube/laravel-flexible-content
Latest Version:v0.0.1
PHP:>=8.0.0
License:MIT
Last Updated:Mar 26, 2026
Links: GitHub  ·  Packagist
Maintainer: Whitecube

laravel-flexible-content

This package's only purpose is to build custom repeated layout components, such as Laravel Nova's Flexible Content field or your own content builders and manageable component collections. It is meant to provide a tested and multi-purpose backend API that should be extended by specific components (regardless of their frontend stack).

Docs (under construction)

  • Installation & base use cases
  • layouts registration
    • register($layout, $limit)
  • get all registered layouts
    • layouts()
    • layoutsMenu()
  • limiting layouts
    • limit($instances)
    • $layout->limit($instances)
  • building instances
    • build($data)
    • buildUsing($callback)
    • insert($key, $attributes, $index, $id)
  • serializing the flexible container's state
    • serialize()
    • serializeAs($format)
    • serializeUsingFormat($format)
    • serializeUsing($callback)
  • get all inserted instances, and manipulate the LayoutCollection :
    • instances()
    • instancesValues()
    • $instances->find($key)
    • $instances->whereKey($key)
    • $instances->whereKeyNot($key)
    • $instances->whereKeyIn($key)
    • $instances->whereKeyNotIn($key)
  • counting instances
    • count($key = null)

Testing

This library uses PestPHP. If you're considering contributing, please make sure all existing tests are still valid and that your changes are fully covered before submitting a PR.

Once installed, run the tests using ./vendor/bin/pest.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

631,580,251 9,707
laravel/framework

The Laravel Framework.

580,311,802 34,925
laravel/tinker

Powerful REPL for the Laravel framework.

489,754,436 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

404,034,618 608
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

384,821,166 4,658