PHPackages                             laravel-enso/formbuilder - 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. laravel-enso/formbuilder

Abandoned → [laravel-enso/forms](/?search=laravel-enso%2Fforms)Library[Templating &amp; Views](/categories/templating)

laravel-enso/formbuilder
========================

JSON-based form builder for Laravel Enso

9.1.1(3w ago)12318.7k3010MITPHPPHP ^8.0

Since Aug 8Pushed 3w ago10 watchersCompare

[ Source](https://github.com/laravel-enso/forms)[ Packagist](https://packagist.org/packages/laravel-enso/formbuilder)[ Docs](https://github.com/laravel-enso/forms)[ RSS](/packages/laravel-enso-formbuilder/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (8)Versions (295)Used By (10)

Forms
=====

[](#forms)

[![License](https://camo.githubusercontent.com/403ac33263e67dab885a6376503bdfdfbe1e69b9ae180dc9e2b5cdf76bb12813/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f666f726d732f6c6963656e7365)](LICENSE)[![Stable](https://camo.githubusercontent.com/1f96bbf107683aa8f40f2102f93aa3451afde1177f8d9d5a85fe1d80b44f14a5/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f666f726d732f76657273696f6e)](https://packagist.org/packages/laravel-enso/forms)[![Downloads](https://camo.githubusercontent.com/bab630d9d8ba4ccaee27cf57f2b0b064047bb4071a49f8935bea4106ef6e758a/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2d656e736f2f666f726d732f646f776e6c6f616473)](https://packagist.org/packages/laravel-enso/forms)[![PHP](https://camo.githubusercontent.com/ef6afd4ccdaa708a9b1a0a353d6d03a13ca1f03887b8db701d4118dc30a6735a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e302532422d3737376262342e737667)](composer.json)[![Issues](https://camo.githubusercontent.com/24641213ec91fac71cec38894512825b57cc4a06a666267a68ccb4b191c2721f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6c61726176656c2d656e736f2f666f726d732e737667)](https://github.com/laravel-enso/forms/issues)[![Merge Requests](https://camo.githubusercontent.com/c47b788b94eb453d24f878e8acadfed365562e08a4c29eff5a9d0e55d0fc5fc5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d70722f6c61726176656c2d656e736f2f666f726d732e737667)](https://github.com/laravel-enso/forms/pulls)

Description
-----------

[](#description)

Forms is the JSON-based form builder used across Laravel Enso backends.

The package loads form templates from JSON, builds create and edit payloads around Eloquent models, computes actions and meta configuration, validates template structure, and ships test traits for common create/edit/destroy flows.

It is a backend payload builder, not a standalone UI package. The canonical frontend companion is [`@enso-ui/forms`](https://github.com/enso-ui/forms), which renders the payloads produced by this package.

Installation
------------

[](#installation)

Install the package:

```
composer require laravel-enso/forms
```

Optional publishes:

```
php artisan vendor:publish --tag=forms-config
php artisan vendor:publish --tag=forms-resources
```

Features
--------

[](#features)

- JSON template loading through `Form`.
- Create and edit payload generation for Eloquent-backed forms.
- Runtime mutation helpers for values, labels, options, visibility, readonly state, and route metadata.
- Template validation for structure, actions, routes, and fields.
- PHPUnit test traits for form workflows.
- Direct integration with the Enso frontend form renderer and its field components.

Usage
-----

[](#usage)

Create or edit a form payload:

```
use LaravelEnso\Forms\Services\Form;

$form = new Form(__DIR__.'/Templates/example.json');

$createPayload = $form->create();
$editPayload = $form->edit($model);
```

### Template structure

[](#template-structure)

The JSON template must include at least:

- `method`
- `sections`
- `routeParams`

The root template may also include:

- `title`, `icon`
- `actions`
- `authorize`
- `autosave`
- `clearErrorsControl`
- `debounce`
- `dividerTitlePlacement`
- `labels`
- `params`
- `readonly`
- `routePrefix`
- `routes`
- `tabs`

Each section must define:

- `columns`
- `fields`

Optional section attributes are:

- `divider`
- `title`
- `column`
- `tab`
- `slot`
- `hidden`

Each field must define:

- `label`
- `name`
- `value`
- `meta`

### Minimal template example

[](#minimal-template-example)

```
{
    "title": "Example",
    "icon": "user",
    "method": null,
    "routePrefix": "administration.users",
    "routeParams": {},
    "actions": ["store", "update", "destroy", "back"],
    "sections": [
        {
            "columns": 2,
            "title": "General",
            "fields": [
                {
                    "label": "Name",
                    "name": "name",
                    "value": "",
                    "meta": {
                        "type": "input",
                        "content": "text",
                        "custom": false
                    }
                },
                {
                    "label": "Roles",
                    "name": "roles",
                    "value": [],
                    "meta": {
                        "type": "select",
                        "multiple": true,
                        "source": "administration.roles.options",
                        "custom": false
                    }
                }
            ]
        }
    ]
}
```

### `Form` service API

[](#form-service-api)

The `LaravelEnso\Forms\Services\Form` object is not just a loader. It is a fluent mutator for the template before `create()` or `edit()` finalizes the payload.

Common methods:

- `create(?Model $model = null)`
- `edit(Model $model)`
- `actions(...$actions)`
- `routePrefix(string $prefix)`
- `route(string $action, string $route)`
- `routeParams(array $params)`
- `title(string $title)`
- `icon(string $icon)`
- `append(string $param, mixed $value)`
- `authorize(bool $authorize)`
- `labels(bool $labels)`

Field and section mutators:

- `label(string $field, string $value)`
- `options(string $field, mixed $value)`
- `value(string $field, mixed $value)`
- `meta(string $field, string $param, mixed $value)`
- `columns(string $section, int $value)`
- `hide(...$fields)` / `show(...$fields)`
- `disable(...$fields)`
- `readonly(...$fields)`
- `readonly()` / `readonly(bool $readonly)`
- `hideSection(...$sections)` / `showSection(...$sections)`
- `hideTab(...$tabs)` / `showTab(...$tabs)`

Example:

```
use LaravelEnso\Forms\Services\Form;

$form = (new Form(app_path('Forms/Templates/users.json')))
    ->title('Edit User')
    ->icon('user')
    ->routePrefix('administration.users')
    ->append('locale', app()->getLocale())
    ->label('email', 'Login Email')
    ->options('role_id', $roles)
    ->value('is_active', true)
    ->readonly('email')
    ->readonly()
    ->hide('password')
    ->meta('phone', 'placeholder', '+40 700 000 000');

$payload = $form->edit($user);
```

### Supported field types

[](#supported-field-types)

The backend validator accepts these `meta.type` values:

- `input`
- `select`
- `datepicker`
- `timepicker`
- `textarea`
- `password`
- `wysiwyg`

The frontend companion `@enso-ui/forms` currently renders these combinations:

- `input` with `content: text`
- `input` with `content: number`
- `input` with `content: email`
- `input` with `content: password`
- `input` with `content: encrypt`
- `input` with `content: money`
- `input` with `content: checkbox`
- `select`
- `textarea`
- `datepicker`
- `timepicker`
- `wysiwyg`

Important behavior:

- encrypted inputs are returned as `************************` when the model already has a value
- root `readonly` is preserved in the payload so the frontend can render the whole form without mutating actions
- field-level `meta.readonly` remains available for locking individual fields
- multi-select values are normalized to arrays of tracked keys
- datepicker values are formatted with the configured or field-specific format
- select `source` routes are converted to relative application paths
- select fields that define enum class `options` are expanded through `::select()` and default to translated labels
- `wysiwyg` fields use TinyMCE by default and receive the configured TinyMCE API key automatically
- `wysiwyg` fields may set `editor: trix` to use the Trix frontend editor instead

### Supported meta keys

[](#supported-meta-keys)

The validator accepts the following optional `meta` keys:

- `options`, `multiple`, `custom`, `content`
- `step`, `min`, `max`
- `disabled`, `readonly`, `hidden`
- `source`, `format`, `altFormat`, `time`
- `rows`, `placeholder`
- `trackBy`, `label`
- `tooltip`, `symbol`, `precision`, `thousand`, `decimal`
- `positive`, `negative`, `zero`
- `resize`, `translated`
- `time12hr`, `disable-clear`
- `objects`, `toolbar`, `plugins`, `editor`, `taggable`
- `searchMode`, `params`, `pivotParams`, `customParams`

### Template validation rules

[](#template-validation-rules)

`Validator` runs four checks:

- `Structure`: verifies root attributes, section format, columns, and tab consistency
- `Actions`: only allows Enso form actions supported by the package
- `Routes`: requires actual named routes for every action except `back`
- `Fields`: verifies field attributes, checkbox values, select value shape, and delegates `meta` validation

Notable enforced rules:

- create forms can use only `back` and `store`
- update forms can use only `back`, `create`, `show`, `update`, and `destroy`
- `select` fields must define `options` or `source`
- checkbox fields must have boolean values
- multi-select fields must receive array or object values
- `columns: custom` requires an integer `column` per field

Enum-backed select fields may opt out of frontend label translation by setting `"translated": false` explicitly in the template.

### Frontend companion

[](#frontend-companion)

The canonical renderer is [`@enso-ui/forms`](https://github.com/enso-ui/forms).

Its public Vue components are:

- `EnsoForm`
- `VueForm`
- `CoreForm`

The package integrates with companion UI packages such as:

- `@enso-ui/select`
- `@enso-ui/datepicker`
- `@enso-ui/wysiwyg`
- `@enso-ui/money`
- `@enso-ui/switch`
- `@enso-ui/tabs`

`EnsoForm` also exposes runtime helpers to the host application, including:

- `fetch()`
- `submit()`
- `field(name)`
- `param(name)`
- `routeParam(name)`
- `fill(state)`
- `setOriginal()`
- `undo()`
- `hideField(name)` / `showField(name)`
- `hideTab(name)` / `showTab(name)`

API
---

[](#api)

### Services

[](#services)

- `LaravelEnso\\Forms\\Services\\Form`
- `LaravelEnso\\Forms\\Services\\Builder`
- `LaravelEnso\\Forms\\Services\\Validator`

### Published resources

[](#published-resources)

- `config/enso/forms.php`
- `app/Forms/Builders/ModelForm.php`
- `app/Forms/Templates/template.php`

### Configuration highlights

[](#configuration-highlights)

- `validations`
- `buttons`
- `altDateFormat`
- `selectPlaceholder`
- `authorize`
- `dividerTitlePlacement`
- `labels`
- `tinyMCEApiKey`

### Test traits

[](#test-traits)

- `CreateForm`
- `EditForm`
- `DestroyForm`

Depends On
----------

[](#depends-on)

Required Enso packages:

- [`laravel-enso/enums`](https://docs.laravel-enso.com/backend/enums.html) [↗](https://github.com/laravel-enso/enums)
- [`laravel-enso/helpers`](https://docs.laravel-enso.com/backend/helpers.html) [↗](https://github.com/laravel-enso/helpers)

Companion frontend package:

- [`@enso-ui/forms`](https://docs.laravel-enso.com/frontend/forms.html) [↗](https://github.com/enso-ui/forms)

Contributions
-------------

[](#contributions)

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

###  Health Score

67

—

FairBetter than 99% of packages

Maintenance95

Actively maintained with recent releases

Popularity40

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 76.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 ~11 days

Recently: every ~6 days

Total

281

Last Release

23d ago

Major Versions

1.3.7 → 2.3.182018-02-15

2.12.11 → 3.0.02019-03-08

3.4.13 → 4.0.02020-06-24

4.8.0 → 5.0.02026-04-09

5.2.1 → 9.1.02026-06-09

PHP version history (4 changes)1.0.0PHP &gt;=7.1.0

3.4.0PHP &gt;=7.4.0

4.3.8PHP &gt;=8.0

4.6.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16073274?v=4)[Adrian Ocneanu](/maintainers/aocneanu)[@aocneanu](https://github.com/aocneanu)

---

Top Contributors

[![aocneanu](https://avatars.githubusercontent.com/u/16073274?v=4)](https://github.com/aocneanu "aocneanu (347 commits)")[![gandesc](https://avatars.githubusercontent.com/u/14071925?v=4)](https://github.com/gandesc "gandesc (43 commits)")[![vmcvlad](https://avatars.githubusercontent.com/u/37445394?v=4)](https://github.com/vmcvlad "vmcvlad (21 commits)")[![raftx24](https://avatars.githubusercontent.com/u/10864136?v=4)](https://github.com/raftx24 "raftx24 (17 commits)")[![jlsjonas](https://avatars.githubusercontent.com/u/932193?v=4)](https://github.com/jlsjonas "jlsjonas (7 commits)")[![DevIonut](https://avatars.githubusercontent.com/u/19207797?v=4)](https://github.com/DevIonut "DevIonut (6 commits)")[![mauthi](https://avatars.githubusercontent.com/u/7204559?v=4)](https://github.com/mauthi "mauthi (4 commits)")[![boing6000](https://avatars.githubusercontent.com/u/3080041?v=4)](https://github.com/boing6000 "boing6000 (3 commits)")[![GITmanuela](https://avatars.githubusercontent.com/u/44998004?v=4)](https://github.com/GITmanuela "GITmanuela (2 commits)")[![AbdullahiAbdulkabir](https://avatars.githubusercontent.com/u/33360580?v=4)](https://github.com/AbdullahiAbdulkabir "AbdullahiAbdulkabir (2 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")

---

Tags

form-builderlaravellaravel-ensoFormsform-builderlaravel-ensojson-templates

### Embed Badge

![Health badge](/badges/laravel-enso-formbuilder/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-enso-formbuilder/health.svg)](https://phpackages.com/packages/laravel-enso-formbuilder)
```

###  Alternatives

[laravel-enso/forms

JSON-based form builder for Laravel Enso

12354.2k84](/packages/laravel-enso-forms)[laravel-enso/tables

Server-side data tables and export backend for Laravel Enso

63355.1k83](/packages/laravel-enso-tables)[laravel-enso/data-import

Excel Importer dependency for Laravel Enso

2044.0k6](/packages/laravel-enso-data-import)[laravel-enso/permissions

Permission management for Laravel Enso

1244.2k51](/packages/laravel-enso-permissions)[laravel-enso/tutorials

Tutorial management backend for Laravel Enso

1140.7k](/packages/laravel-enso-tutorials)[laravel-enso/roles

Role management for Laravel Enso

1044.9k32](/packages/laravel-enso-roles)

PHPackages © 2026

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