flatpack/flatpack

Flatpack: Administration panel for Laravel, ready to assemble.

v1.0.17 2023-12-15 18:49 UTC

README

Image of package

Latest Version on Packagist License Test Coverage GitHub Tests Status GitHub Code Style Status

Flatpack

📦 Administration panel for Laravel, ready to assemble.

  • Quickly create a CMS for your Eloquent models.
  • Define components with simple and declarative YAML files.
  • Build a complete administration panel for your Laravel app in seconds.

📕 Official Documentation

Flatpack makes building fully functional user interfaces for admin panels easier than ever: as easy as editing few lines of a YAML file.

Besides providing a rich set of already built components and a solid stack to build a secure and intuitive experience for the users, it offers a fast and flexible solution for developers who want to have fun, try out new things and save precious time building up the an administration panels.

Flatpack is a reactive full-stack app, built with TALL stack.

Demo

Quick Install

Install the package via composer:

composer require flatpack/flatpack

Publish the config file and compiled assets:

php artisan vendor:publish --tag="flatpack"

Note: To make sure that the public assets are always up-to-date, remember to add this command to the post-update-cmd list in your composer.json file.

  "post-update-cmd": [
      "@php artisan vendor:publish --tag=flatpack"
  ],

Usage

Generating Flatpack composition files for App\Models\Post model...

php artisan make:flatpack Post

This command will create two files:

  • A form template /flatpack/posts/form.yaml, that defines the posts form.
  • A list template /flatpack/posts/list.yaml, that defines the posts table with pagination.

Let's check the result, visit /backend/posts.

Now start assembling, grab the generated files and map your model's attributes as you need.

Examples

Defining a form:

title: Post
model: App\Models\Post
icon: book-open

toolbar:
  save:
    type: button
    label: Save
    action: save
    style: primary
    shortcut: s

main:
  title:
    label: Post Title
    placeholder: Your Post Title
    type: text

  body:
    type: block-editor

sidebar:
  created_at:
    label: Created
    type: datetime-picker

  updated_at:
    label: Updated
    type: datetime-picker

Defining a list:

title: Post
model: App\Models\Post
icon: book-open
order: 1

toolbar:
  create:
    label: New Post
    icon: plus
    link: create
    style: primary
    shortcut: enter

columns:
  id:
    label: ID
    sortable: true
    invisible: true

  title:
    label: Title
    sortable: true
    searchable: true

  created_at:
    label: Created
    type: datetime
    format: "Y-m-d H:i:s"
    sortable: true

  updated_at:
    label: Updated
    type: datetime
    format: "Y-m-d H:i:s"
    sortable: true

⚙️ You can customise the yaml composition files by mapping your model's attributes, using components of differnt types and features: Data tables, text inputs, rich text editors, date pickers, tag pickers, searchable select menus, image upload, toggles and more.

📖 Check out the documentation

Requirements

  • PHP 8.x
  • Composer
  • Laravel 9.x

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Contributions are welcome! Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.