PHPackages                             dimonka2/flatform - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dimonka2/flatform

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dimonka2/flatform
=================

Form helper for Laravel

0.3.0(4y ago)21383MITPHPPHP ^7 | ^8CI failing

Since Jan 16Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Dimonka2/flatform)[ Packagist](https://packagist.org/packages/dimonka2/flatform)[ Docs](https://github.com/Dimonka2)[ RSS](/packages/dimonka2-flatform/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)Dependencies (5)Versions (10)Used By (0)

Laravel Flatform
================

[](#laravel-flatform)

[![Packagist](https://camo.githubusercontent.com/001e455c1d45ce4f91f0d7d90538424fcb50622bba6db8bb6fdaa860b4232fde/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64696d6f6e6b61322f666c6174666f726d2e737667)](https://packagist.org/packages/dimonka2/flatform)[![Packagist](https://camo.githubusercontent.com/4837934dabcc5038b4d65085ea2287ad21de6b529f61339305dd9769594c7926/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f64696d6f6e6b61322f666c6174666f726d2e737667)](https://packagist.org/packages/dimonka2/flatform)![Packagist](https://camo.githubusercontent.com/bfbed3208dd5f4ddc075366ef0774cf2322b00893b51dd8548c59f1be0950440/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f64696d6f6e6b61322f666c6174666f726d2e737667)

HTML control rendering helper for Laravel and Livewire

Features
--------

[](#features)

- **Separate control rendering from control styling.** Write only an interface definition and the styling will be applied based on selected templates.
- **Possibility to switch styles via config.** It is possible to declare several styles and switch between them. Option to switch styles at runtime is coming soon.
- **Write less code.** Using this approach you define control styles once and focus only on interface declaration.
- **Livewire table component.** Unique Livewire table with sorting, search, filters, actions, row select, column formatters and sub details.

Install
-------

[](#install)

composer require dimonka2/flatform

Publish provider:

$ php artisan vendor:publish --provider="dimonka2\\flatform\\FlatformServiceProvider"

Configure
---------

[](#configure)

Coming soon

Using in the blade
------------------

[](#using-in-the-blade)

Following text creates text inputs with labels

```
@form([
    ['row', [
        ['text', 'label' => 'First name', 'name' => 'first_name',],
        ['text', 'label' => 'Last name', 'name' => 'last_name',],
    ]]
])
```

Depending on styles the code above will generate something like:

```

        First name

        Last name

```

Included elements, inputs and components
----------------------------------------

[](#included-elements-inputs-and-components)

- **Inputs**: text, password, number, textarea, select, file, date, checkbox, radio, hidden, select2, bootstrap select, summernote
- **Components**: alert, breadcrumb, button, dropdown, progress, tabs, card, datatable, table
- **Trait for datatable**
- **HTML tags**: form, text, div, row (div with class "row"), col (div with class 'col-xx')
- **Blade directives**: stack, include, yield, section, Livewire
- **TableComponent**: Livewire table component

Documentation
-------------

[](#documentation)

Coming soon

TableComponent
--------------

[](#tablecomponent)

In order to create a Livewire TableComponent you cave to create a class in your Livewire folder that is derived from *TableComponent* class. See following sample code:

```
namespace App\Http\Livewire\User;

use App\Models\User;
use dimonka2\flatform\Flatform;
use dimonka2\flatform\Livewire\TableComponent;
use dimonka2\flatform\Form\Components\Table\Table;

class UserList extends TableComponent
{
protected function getTable(): ?Table
    {
        $table = new Table([
            'class' => 'table table-hover',
            'columns' => [
                ['name' => 'name'       , 'title'   => 'Name'       , 'search',    ],
                ['name' => 'email'      , 'title'   => 'Email'      , 'search',    ],
                ['name' => 'position'   , 'title'   => 'Position'   , 'search',    ],
                ['name' => 'updated_at' , 'title'   => 'Last update', 'sort' => 'Desc'  , '_format' => "date", ],
                ['name' => 'id', 'hide'],
            ],
            'order' => 'updated_at',
            'query' => User::whereNull('disabled_at'),
        ]);

        return $table;
    }
}
```

This component will generate a table with a user list with 4 columns.

### Table component properties and functions

[](#table-component-properties-and-functions)

Class: `dimonka2\flatform\Livewire\TableComponent`

PropertyDefaultUsage`idField`'id'ID field that needs to be is equal to key column name field. This field is required to be properly setup if you use **Table Select** or **Table Details** functions`selectAll`falseIndicates whether user has clicked 'Select all' checkbox`search`nullCurrent search string`searchDebounce`500Search input bounce time, see Livewire documentation`order`""Currently ordered column name. The format could be a name as a string or an array like \['fieldName' =&gt; 'DESC\]`length`10Currently selected number of elements per page`class`??`expanded`\[\]Array of expanded row IDs`filtered`\[\]Array of filter values`selected`\[\]Array of selected row IDs`info`// make it false to exclude info column`table`Contains the current instance of Table definition`rowsReady`nullIndicates that table rows are queried and prepared for rendering`scrollUp`trueScrolls page up to the table header after paginator clickTable component has also few functions, that can be called, defined or overridden:

FunctionDefinedParametersUsage`getTable()`yesThis is the main function that returns Table class that describes the table properties. This function has to return class `dimonka2\flatform\Form\Components\Table\Table``getQuery()`noEnables defining table query as a separate function, it has to return `Builder` class`getSelect()`noEnables defining table Select as a separate function`getDetails()`noEnables defining table Details as a separate function`getActions()`noEnables defining table Actions as a separate function`getFilters()`noEnables defining table Filters as a separate function`getView()`yes$viewNameBy overriding this function you may replace default table views by your own views blades`getLengthOptions()`yesEnables to override length option: number of items per page in filter dropdown### Table definition properties

[](#table-definition-properties)

Class: `dimonka2\flatform\Form\Components\Table\Table`

PropertyDefaultUsage`actions`nullDefine table actions as sub array`columns`\[\]Sub array with table column definitions. See **Table Column properties** section`details`nullEnables table row details as sub array options. See **Table Details properties** section`filters`nullEnables table query filters as sub array options. See **Table Filter properties** section`lengthOptions`\[10, 20, 30, 50, 100\]Number of items per page in filter dropdown`evenOddClasses`\['even', 'odd'\]Array with even/odd classes`query`nullLaravel Builder query that might contain any kind of joins, whereExists, with or Counts`search`nullSetting this property to `false` will disable and hide table search functionality`select`nullEnables and define row select options as sub array options. See **Table Select properties** section`rows`nullSub array with table rows definitions. You can define content of rows and columns without setting up `query` property`formatters`\[\]Lookup array for custom column formatters`formatFunction`nullTD element format closure function`links`nullSetting this property to `false` will hide pagination links`rowRenderCallback`nullCallback required for a Livewire table to separate table from rows rendering, currently unused. Closure parameters: ($row, $html, $details = false)`rowPreRenderCallback`nullAllows to update row definition before it is rendered to HTML. Closure parameters ($row, array $def): array`order`nullDefault ordered column. Can be defined as a column name or as `false` to disable table ordering### Table Column properties

[](#table-column-properties)

PropertyDefaultUsage`name`nullField name, this name is queried from the query via select, also the row data will use field name as a key`title`nullColumn title used in a header. Title might be in Flatform rendering format`search`falseSetting this property to true will include this column in text search query`sort`ASCSetting to false will disable sort by this column, setting column to "DESC" will make DESC as default (first) sort order`system`falseSetting this property to true means a virtual (calculated) field without adding it to select query statement with disabled sort and search. Useful for calculated fields and menu elements`class`nullClass will be added to column's TD and TH tag class attribute`titleClass`nullClass will be added to column's TH tag class attribute`tdClass`nullClass will be added to column's TD tag class attribute`hide`false`true` denotes that this column will not be rendered`raw`nullThis option might be used when you need a calculated value and it used as DB:raw select statement`noSelect`nullSetting this to true denotes a special case for some columns are in a select statement and there is no need to add an extra select, like “count()”`as`see usageThis property specifies field alias and how this column will be mapped to the Model attributes. If this field is undefined for a column fields with table name like `users.name` will have a replacement of dot to '\_\_' e.g. `users__name``format`nullColumn format: callable (IColumnFormat), Flatform language definition or container`_format`nullQuick column format: 'number','link', 'check', 'str' or an array with additional parameters`width`nullColumn width style. Column width will be added to the header style and each TD tag style### Table Details properties

[](#table-details-properties)

Table Details is a pull down row that may contain any additional details connected to the row including even Livewire components.

PropertyDefaultUsage`expander`Flatform expanderYou may override default table expander by defining this property. See default expander setup in `TableDetails::default_expander``callback`nullClosure function that should return the content of the row details, defined as `function ($row){}``disabled`falseSetting this option to true will disable details`title`nullDetail column title`class`nullStyle classes that will be applied to the expander TD element`trClass`nullStyle classes that will be applied to the details TR element`tdClass`nullStyle classes that will be applied to the details TD element`width`nullExpander column width styleExample of table with details:

```
protected function getTable(): ?Table
    {
        $table = new Table([
            'columns' => [
                // ...
            ],
            'details' => [
                'callback' => function($row) {
                    // get a queried model from the row
                    $model = $row->_item;
                    return 'Model name: ' . $model->name . '';
                    // or alternatively in Flatform language:
                    return [['span', 'text' => 'Model name: '], ['strong', 'text' => $model->name]];
                }
            ],
        ]);

        return $table;
    }
}
```

### Table Select properties

[](#table-select-properties)

Table Select is an additional checkbox in most left column that enables to select table rows.

PropertyDefaultUsage`checkbox`Flatform checkboxDefinition of the checkbox in flatform format`headerCheckbox`Flatform checkboxDefinition of the checkbox in header that works as "select all" in flatform format`column`???`disabled`falseSetting this option to `true` will disable Table Select`width`nullCheckbox column width style`selectCallback`nullCallback function used internally by the TableComponent to determine whether the row is selected`class`nullStyle classes that will be applied to the selected row TR elementExample of table with Select that will highlight selected rows using class `table-primary`:

```
protected function getTable(): ?Table
    {
        $table = new Table([
            'columns' => [
                // ...
            ],
            'select' => [
                'class' => 'table-primary',
            ],
        ]);

        return $table;
    }
}
```

### Table Action properties

[](#table-action-properties)

Table actions should be defined together with TableSelect as they currently rendered for selected items.

PropertyDefaultUsage`name`Action unique name. This can be ignored. See example.`position`nullarray where action is rendered: `selection`, `dropdown`, `row`, `row-dd``title`action title or label`disabled`falseSetting this option to `true` will disable this action`callback`Action callback. This can be ignored. See example.`attributes`All other elements. Those attributes are populated automatically from the unspecified action propertiesExample of table with Table Select and Actions:

```
    protected function getTable(): ?Table
        {
            return new Table([
                'columns' => [
                    // ...
                ],
                'select' => [
                ],
                'actions' => [
                    // in this case we just calling a normal Livewire action for this action
                    ['title' => 'Disable selected users', 'position' => 'dropdown',
                        'icon' => 'fa fa-ban', 'wire:click.prevent' => 'disableUsers', 'href' => '#'],
                ],
            ]);

        }
    }
    // handle action
    public function disableUsers()
    {
        // get selected models
        $users = $this->getSelected(true);
        // disable users one by one
        foreach ($users as $user) {
            if($user->id != Auth::user()->id) {
                $user->disabled = $disable;
                $user->update();
            }
        }
        // reload table rows in order to populate changes
        $this->reload();
    }
```

### Table Filter properties

[](#table-filter-properties)

Filter is a basic Flatform input control that is associated with persistent input and a closure function that can be attached to filter query based on the user input.

PropertyDefaultUsage`name`Filter name, assigned to input. This name is used to map filter input. Name has to be unique.`title`Filter control title or label`type`Filter type: checkbox, select, text`disabled`falseDisables filter`value`Default value`list`Item list for select, might be a closure`filterFunction`Filter callback in format: `function($query, $data) {}`

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.9% 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 ~72 days

Recently: every ~120 days

Total

8

Last Release

1803d ago

PHP version history (3 changes)0.1.3PHP ^7.0

0.1.7PHP ^7

0.3.0PHP ^7 | ^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/77a8670827b6d4a1bff647d3b968379b8da50a4c709c37c3a22e343bfe38ab27?d=identicon)[dimonka2](/maintainers/dimonka2)

---

Top Contributors

[![Dimonka2](https://avatars.githubusercontent.com/u/19688204?v=4)](https://github.com/Dimonka2 "Dimonka2 (238 commits)")[![Dimonka01](https://avatars.githubusercontent.com/u/25383254?v=4)](https://github.com/Dimonka01 "Dimonka01 (118 commits)")

---

Tags

bootstraphtmllaravellivewirelivewire-componentstablecomponentphplaravelhelperForms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dimonka2-flatform/health.svg)

```
[![Health](https://phpackages.com/badges/dimonka2-flatform/health.svg)](https://phpackages.com/packages/dimonka2-flatform)
```

###  Alternatives

[laravelista/ekko

Framework agnostic PHP package for marking navigation items active.

278673.4k4](/packages/laravelista-ekko)[netojose/laravel-bootstrap-4-forms

Bootstrap 4 form builder for Laravel 5

182115.3k](/packages/netojose-laravel-bootstrap-4-forms)[lazerg/laravel-enum-pro

A powerful PHP enum extension with collection support, random selection, and magic static calls

4319.0k](/packages/lazerg-laravel-enum-pro)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[stevenmaguire/zurb-foundation-laravel

Build HTML form elements for Foundation inside Laravel

203.8k](/packages/stevenmaguire-zurb-foundation-laravel)[tonegabes/filament-better-options

Filament form components for better radio and checkbox options.

155.2k](/packages/tonegabes-filament-better-options)

PHPackages © 2026

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