PHPackages                             distilleries/layout-manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. distilleries/layout-manager

ActiveLibrary[Templating &amp; Views](/categories/templating)

distilleries/layout-manager
===========================

Create and manage your own custom layouts with this simple widget based plugin.

0.2.0(9y ago)0988MITPHPPHP &gt;=5.5.0

Since Feb 3Pushed 8y ago3 watchersCompare

[ Source](https://github.com/Distilleries/Layout-Manager)[ Packagist](https://packagist.org/packages/distilleries/layout-manager)[ RSS](/packages/distilleries-layout-manager/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (11)Versions (5)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7fc2485e2d1c5f3c7b42c28d099ca5135a759055c25b342a3d7c60db7c21cbc1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f44697374696c6c65726965732f4c61796f75744d616e616765722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Distilleries/LayoutManager/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/0a095998920dae1f1d51b873418948aefd0316b0f4da17ed31a5314e3f04febd/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f44697374696c6c65726965732f4c61796f75744d616e616765722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Distilleries/LayoutManager/?branch=master)[![Build Status](https://camo.githubusercontent.com/ed89cf0f0b285d22b87b8cec1ea7e97a0d25bdfcae13c6c1563d701428ad7225/68747470733a2f2f7472617669732d63692e6f72672f44697374696c6c65726965732f4c61796f75744d616e616765722e737667)](https://travis-ci.org/Distilleries/LayoutManager)[![Total Downloads](https://camo.githubusercontent.com/e0618f72e8ba29d7f6992a1d4ba0f2a95d58bc1a8d913bbc75def4f19efb4bdd/68747470733a2f2f706f7365722e707567782e6f72672f64697374696c6c65726965732f6c61796f75742d6d616e616765722f646f776e6c6f616473)](https://packagist.org/packages/distilleries/layout-manager)[![Latest Stable Version](https://camo.githubusercontent.com/dd6b6fd2ff7fc424d0dd88c3bab19fb800080cc76aea1b031ab6a5fea93adb25/68747470733a2f2f706f7365722e707567782e6f72672f64697374696c6c65726965732f6c61796f75742d6d616e616765722f76657273696f6e)](https://packagist.org/packages/distilleries/layout-manager)[![License](https://camo.githubusercontent.com/f251623e510f5909f16ae3f4e6e548dac11340b9fde1a99be26b015b39272c00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE)

Laravel 5 Layout Manager
========================

[](#laravel-5-layout-manager)

Requires expendable with form-builder.

Table of contents
-----------------

[](#table-of-contents)

1. [Installation](#installation)
2. [Basic usage](#basic-usage)
    1. [Configuration](#1-configuration)
    2. [Create templates](#2-create-templates)
3. [Template Styling](#template-styling)
4. [Options](#options)
    1. [Categories](#1-categories)
    2. [Filter templates](#2-filter-templates)
    3. [Custom tags](#3-custom-tags)
    4. [Disable add and ordering](#4-disable-add-and-ordering)
    5. [Special classes](#5-special-classes)
5. [Troubleshooting](#troubleshooting)

\##Installation

Add on your composer.json

```
    "require": {
        "distilleries/layout-manager": "1.*",
    }
```

Add on your bower.json

```
    "dependencies": {
        "sortablejs": "1.4.2",
    }
```

Add on your build.config.js

```
    "admin": {
        "app_files": {
            "js": {
                "bower_components/sortablejs/Sortable.min.js"
            }
        }
    }
```

Import the sass into your application.admin.scss

```
    // ...
    @import "../../../../vendor/distilleries/layout-manager/src/resources/assets/sass/layout-manager";
```

run `composer update`.

Add Service provider to `config/app.php`:

```
    'providers' => [
        // ...
       Distilleries\LayoutManager\LayoutManagerServiceProvider::class,
       Distilleries\LayoutManager\LayoutManagerRouteServiceProvider::class
    ]
```

Add the controller to your admin menu `config/expendable.php`:

```
{
    // ...
    'menu' => \Distilleries\Expendable\Config\MenuConfig::menu([
        'left'  => [
                [
                    'icon'    => 'blackboard',
                    'action'  => '\Distilleries\LayoutManager\Http\Controllers\Admin\TemplateController@getIndex',
                    'libelle' => 'menu.templates',
                    'submenu' => [
                        [
                            'icon'    => 'th-list',
                            'libelle' => 'menu.list',
                            'action'  => '\Distilleries\LayoutManager\Http\Controllers\Admin\TemplateController@getIndex',
                        ],
                        [
                            'icon'    => 'pencil',
                            'libelle' => 'menu.add',
                            'action'  => '\Distilleries\LayoutManager\Http\Controllers\Admin\TemplateController@getEdit',
                        ],
                    ]
                ],
        ]
}
```

Add Template field type in `config/form-builder.php`:

```
    [
        // ...
        'template'           => 'layout-manager::form.template',
        'custom_fields' => [
            // ...
            'template'         => 'Distilleries\LayoutManager\FormBuilder\Fields\Template',
        ],
    ]
```

Export the configuration:

```
php artisan vendor:publish --provider="Distilleries\LayoutManager\LayoutManagerServiceProvider"

```

Export the views:

```
php artisan vendor:publish --provider="Distilleries\FormBuilder\FormBuilderServiceProvider"  --tag="views"

```

\##Basic usage

\###1. Configuration

To enable the layout manager in one of you models, you need to update the model first. It should implements TemplatableContract and use TemplatableTrait

```
class Project extends Distilleries\Expendable\Models\BaseModel implements TemplatableContract
{
    use TemplatableTrait;

    // ...
}
```

You can now uses templatable in you Form:

```
class ProjectForm extends Distilleries\FormBuilder\FormValidator
{
    // ...
    public function buildForm()
    {
    // ...
        $this->add('templatable', 'form', [
             'label' => trans('layout-manager::form.templatable'),
             'icon'  => 'link',
             'class' => FormBuilder::create('Distilleries\LayoutManager\Forms\TemplatableForm', [
                 'model' => $this->model,
             ]),
        ]);
    }
    // ...
}
```

The user will now be able to create/order/edit/remove content based on your own templates.

\###2. Create templates

You can create your own templates on the related form in the back-office. Here is a description of each fields that compose a unique template:

FieldDescriptionTitleThe title that will be shown in the back-office "Add template" dropdown listCss classA Unique Css class applied to the template, can be usefull if you want to create your custom css styleHtmlThe template itself. You can put here HTML tags but also custom tags. See [Custom tags](#custom-tags)PluginsTinyMCE Inline plugins you want to add when editing this template.ToolbarTinyMCE Inline toolbar you want to display when editing this template.\##Template Styling

Good practice is to re-use your frontend styling when using LayoutManager. It will allow your contributors to edit content as if they were on the front-end. To do so, create a **folder** in the `sass` folder of your **frontend**. Create one unique `.sass` file for each template, and import this file on each frontend and backend `application.scss`. This template needs to be independant and work in "standalone" (i.e. not related to a container).

This way your style will be displayed on the backoffice as well as on your front.

\##Options

\###1. Categories

When adding content to your model based on your own templates, you may need to categorize them. For example, you may need to show your content within tabs. Each tabs can be defined as a category in LayoutManager.

To do so, you can pass an array of categories in your model's form class like so :

```
class ProjectForm extends Distilleries\FormBuilder\FormValidator
{
    // ...
    public function buildForm()
    {
    // ...
        $this->add('templatable', 'form', [
             'label' => trans('layout-manager::form.templatable'),
             'icon'  => 'link',
             'class' => FormBuilder::create('Distilleries\LayoutManager\Forms\TemplatableForm', [
                 'model' => $this->model,
                 'categories' => [
                     'summary' => 'Summary of the project',
                     'authors' => 'Authors and credits',
                 ]
             ]),
        ]);
    }
    // ...
}
```

The `categories`'s key is the unique string saved in the database to match the category and the `categories`'s value is the text displayed to the contributor in the backoffice.

\###2. Filter templates

The dropdown-list of all the templates the contributor is allowed to add displays ALL the templates by default. You can pre-filter this list to allow only a preset of the templates. Just pass an array of Templates of you own choice in your model's form class:

```
class ProjectForm extends Distilleries\FormBuilder\FormValidator
{
    // ...
    public function buildForm()
    {
    // ...
        $this->add('templatable', 'form', [
             'label' => trans('layout-manager::form.templatable'),
             'icon'  => 'link',
             'class' => FormBuilder::create('Distilleries\LayoutManager\Forms\TemplatableForm', [
                 'model' => $this->model,
                 'templates' => Template::whereIn('css_class', ['bo-banner-image', 'bo-underlined-header'])->get()
             ]),
        ]);
    }
    // ...
}
```

The above example will allow the contributor to add only Templates with css class `bo-banner-image` and `bo-underlined-header`.

\###3. Custom tags

Your frontend may use custom HTML tags (using VueJS or AngularJS). LayoutManager can parse these custom-tags and ask to the contributor to fill some datas. For example, you can have you own `video-player` HTML tag that may need a Youtube ID, like so:

```

```

You can configure LayoutManager to parse these tags and ask the contributor to fill the youtube-id attribute himself. You just need to list all the custom tags in the model's form and their related attributes that need an input from the contributor:

```
class ProjectForm extends Distilleries\FormBuilder\FormValidator
{
    // ...
    public function buildForm()
    {
    // ...
        $this->add('templatable', 'form', [
             'label' => trans('layout-manager::form.templatable'),
             'icon'  => 'link',
             'class' => FormBuilder::create('Distilleries\LayoutManager\Forms\TemplatableForm', [
                 'model' => $this->model,
                 'custom-tags' => [
                     'video-player' => [
                         'youtube_id',
                     ],
                 ]
             ]),
        ]);
    }
    // ...
}
```

This way, every video-player attributes will be clickable in the back-office, a modal will appear that will ask the user to fill `youtube_id`. The attribute's label is translated using `trans(forms.template.youtube_id)`.

\###4. Disable add and ordering

If you want your contributors to edit a pre-defined number of templates, and you don't want them to be able to add, duplicate or reorder the templates, you can use the `disableAdd` option. It can be set either to `true`, or to an array of categories (keys) to only disable it for a list of categories.

```
class ProjectForm extends Distilleries\FormBuilder\FormValidator
{
    // ...
    public function buildForm()
    {
    // ...
        $this->add('templatable', 'form', [
             'label' => trans('layout-manager::form.templatable'),
             'icon'  => 'link',
             'class' => FormBuilder::create('Distilleries\LayoutManager\Forms\TemplatableForm', [
                 'model' => $this->model,
                 'disableAdd' => ['summary'],
                 'categories' => [
                     'summary' => 'Summary of the project',
                     'authors' => 'Authors and credits',
                 ]
             ]),
        ]);
    }
    // ...
}
```

This configuration will disable the add/duplicate/order feature only for the templates under 'summary' category.

\###5. Special classes

#### Image

[](#image)

If you define a `` (or any tag you want) with the CSS class `template-image`, Layout Manager will recognize it and render it as a clickable container. MoxiManager will open on-click and allow the contributor to choose an image that will be displayed in the `background-url` style of the tag.

\##Troubleshooting

@TODO : Handle errors and prevent model form submiting when a template error occurs.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Total

2

Last Release

3409d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1edc17683ed39a2cc6dbe453c2c5aaa63468fc5b54f13941f260ebe260da211?d=identicon)[Kezho](/maintainers/Kezho)

---

Top Contributors

[![jf-m](https://avatars.githubusercontent.com/u/9339799?v=4)](https://github.com/jf-m "jf-m (35 commits)")[![mfrancoisbbs](https://avatars.githubusercontent.com/u/133215273?v=4)](https://github.com/mfrancoisbbs "mfrancoisbbs (13 commits)")[![mfrancois](https://avatars.githubusercontent.com/u/654224?v=4)](https://github.com/mfrancois "mfrancois (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/distilleries-layout-manager/health.svg)

```
[![Health](https://phpackages.com/badges/distilleries-layout-manager/health.svg)](https://phpackages.com/packages/distilleries-layout-manager)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9772.3M122](/packages/roots-acorn)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
