beproteam/dashboard-layout-builder

Dashboard layout builder for Laravel 12, supporting JSON and HTML.

Maintainers

Package info

github.com/beproteam/dashboard-layout-builder

pkg:composer/beproteam/dashboard-layout-builder

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.0.2 2025-09-02 09:35 UTC

This package is auto-updated.

Last update: 2026-03-30 11:09:12 UTC


README

A Laravel package to build dashboard layouts using a fluent, chainable syntax. Output your structure as JSON or renderable HTML (coming soon).

โœจ Features

  • Chainable fluent API
  • Define rows, columns, and content blocks
  • Supports responsive column definitions (sm, md, lg, etc.)
  • Outputs to JSON
  • Easy to extend with new layout components

๐Ÿš€ Installation

composer require beproteam/dashboard-layout-builder

Laravel will auto-discover the service provider.

๐Ÿ“ฆ Basic Usage

use DashboardLayoutBuilder\DashboardLayoutBuilder;
use DashboardLayoutBuilder\LayoutRow;
use DashboardLayoutBuilder\LayoutColumn;
use DashboardLayoutBuilder\LayoutContent;

(new DashboardLayoutBuilder())
    ->schema([
    LayoutRow::make()->schema([
      LayoutColumn::make()->schema([
        LayoutContent::make('content_key')
          ->label('Content Label')
          ->content('contents goes here')
      ])
    ])->columns(['sm' => 2, 'md' => 3])
  ])
  ->toJSON();

โœ… Output Example

{
  "dashboard_layout_builder": [
    {
      "type": "row",
      "columns": {
        "sm": "2",
        "md": "3"
      },
      "contents": [
        {
          "type": "column",
          "contents": [
            {
              "type": "layout_content",
              "key": "content_key",
              "label": "Content Label",
              "contents": "contents goes here"
            }
          ]
        }
      ]
    }
  ]
}

๐Ÿ“š API Reference

DashboardLayoutBuilder::schema(array $layout)

Start building the layout.

LayoutRow::make()->schema([...])->columns([...])

Define a row and optionally set column specifications (e.g. 'md' => 3 or just 3).

LayoutColumn::make()->schema([...])

Define a column which can include other columns, rows, or contents.

LayoutContent::make('key')->label(string $label)->content(mixed $content)

Define a content block with a key, a human-readable label, and content body.

๐Ÿงช Coming Soon

  • HTML output rendering with ->toHtml()
  • Live preview & editor integration
  • Blade component helpers

๐Ÿ“„ License

MIT

๐Ÿค Contributing

Feel free to submit PRs or open issues!
If you'd like to suggest a feature, open a discussion.

๐Ÿ”— Links