laravel-enso / forms
JSON-based form builder for Laravel Enso
Requires
- php: ^8.0
- laravel-enso/enums: ^3.0
- laravel-enso/helpers: ^4.0
- dev-master
- 5.1.2
- 5.1.1
- 5.1.0
- 5.0.0
- 4.8.0
- 4.7.3
- 4.7.2
- 4.7.1
- 4.7.0
- 4.6.4
- 4.6.3
- 4.6.2
- 4.6.1
- 4.6.0
- 4.5.0
- 4.4.4
- 4.4.3
- 4.4.2
- 4.4.1
- 4.4.0
- 4.3.11
- 4.3.10
- 4.3.9
- 4.3.8
- 4.3.7
- 4.3.6
- 4.3.5
- 4.3.4
- 4.3.3
- 4.3.2
- 4.3.1
- 4.3.0
- 4.2.0
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.1
- 4.0.0
- 3.4.13
- 3.4.12
- 3.4.11
- 3.4.10
- 3.4.9
- 3.4.8
- 3.4.7
- 3.4.6
- 3.4.5
- 3.4.4
- 3.4.3
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.11
- 3.3.10
- 3.3.9
- 3.3.8
- 3.3.7
- 3.3.6
- 3.3.5
- 3.3.4
- 3.3.3
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.14
- 3.2.13
- 3.2.12
- 3.2.11
- 3.2.10
- 3.2.9
- 3.2.8
- 3.2.7
- 3.2.6
- 3.2.5
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.9
- 3.1.8
- 3.1.7
- 3.1.6
- 3.1.5
- 3.1.4
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.12.11
- 2.12.10
- 2.12.9
- 2.12.8
- 2.12.7
- 2.12.6
- 2.12.5
- 2.12.4
- 2.12.3
- 2.12.2
- 2.12.1
- 2.12.0
- 2.11.2
- 2.11.1
- 2.11.0
- 2.10.17
- 2.10.16
- 2.10.15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
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-upgrade/laravel13-core12
- dev-codex/phpunit-cleanup
- dev-update/removeLaravelDependecy
- dev-feature/deprecateTinyMce
- dev-upgrade/enso6
- dev-upgrade/enso6-h
- dev-hotfix/visibilityMethods
- dev-feature/hiddenActions
- dev-feature/flexibleColumns
- dev-feature/visible-section
- dev-feature/searchMode
- dev-upgrade/laravel8
- dev-codacy
This package is auto-updated.
Last update: 2026-04-21 15:31:28 UTC
README
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, which renders the payloads produced by this package.
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
- 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
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
The JSON template must include at least:
methodsectionsrouteParams
The root template may also include:
title,iconactionsauthorizeautosaveclearErrorsControldebouncedividerTitlePlacementlabelsparamsroutePrefixroutestabs
Each section must define:
columnsfields
Optional section attributes are:
dividertitlecolumntabslothidden
Each field must define:
labelnamevaluemeta
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
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)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') ->hide('password') ->meta('phone', 'placeholder', '+40 700 000 000'); $payload = $form->edit($user);
Supported field types
The backend validator accepts these meta.type values:
inputselectdatepickertimepickertextareapasswordwysiwyg
The frontend companion @enso-ui/forms currently renders these combinations:
inputwithcontent: textinputwithcontent: numberinputwithcontent: emailinputwithcontent: passwordinputwithcontent: encryptinputwithcontent: moneyinputwithcontent: checkboxselecttextareadatepickertimepickerwysiwyg
Important behavior:
- encrypted inputs are returned as
************************when the model already has a value - multi-select values are normalized to arrays of tracked keys
- datepicker values are formatted with the configured or field-specific format
- select
sourceroutes are converted to relative application paths wysiwygfields receive the configured TinyMCE API key automatically
Supported meta keys
The validator accepts the following optional meta keys:
options,multiple,custom,contentstep,min,maxdisabled,readonly,hiddensource,format,altFormat,timerows,placeholdertrackBy,labeltooltip,symbol,precision,thousand,decimalpositive,negative,zeroresize,translatedtime12hr,disable-clearobjects,toolbar,plugins,taggablesearchMode,params,pivotParams,customParams
Template validation rules
Validator runs four checks:
Structure: verifies root attributes, section format, columns, and tab consistencyActions: only allows Enso form actions supported by the packageRoutes: requires actual named routes for every action exceptbackFields: verifies field attributes, checkbox values, select value shape, and delegatesmetavalidation
Notable enforced rules:
- create forms can use only
backandstore - update forms can use only
back,create,show,update, anddestroy selectfields must defineoptionsorsource- checkbox fields must have boolean values
- multi-select fields must receive array or object values
columns: customrequires an integercolumnper field
Frontend companion
The canonical renderer is @enso-ui/forms.
Its public Vue components are:
EnsoFormVueFormCoreForm
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
Services
LaravelEnso\\Forms\\Services\\FormLaravelEnso\\Forms\\Services\\BuilderLaravelEnso\\Forms\\Services\\Validator
Published resources
config/enso/forms.phpapp/Forms/Builders/ModelForm.phpapp/Forms/Templates/template.php
Configuration highlights
validationsbuttonsaltDateFormatselectPlaceholderauthorizedividerTitlePlacementlabelstinyMCEApiKey
Test traits
CreateFormEditFormDestroyForm
Depends On
Required Enso packages:
Companion frontend package:
Contributions
are welcome. Pull requests are great, but issues are good too.
Thank you to all the people who already contributed to Enso!