PHPackages                             damianulan/laravel-form-forge - 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. damianulan/laravel-form-forge

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

damianulan/laravel-form-forge
=============================

UI Form builder laravel package with custom components based on chosen.js and flatpickr.io. For building forms with PHP builder classes.

1.2.3(1mo ago)25511MITPHPPHP ^8.3CI passing

Since May 13Pushed 1mo agoCompare

[ Source](https://github.com/damianulan/laravel-form-forge)[ Packagist](https://packagist.org/packages/damianulan/laravel-form-forge)[ RSS](/packages/damianulan-laravel-form-forge/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (21)Used By (1)

Laravel FormForge
=================

[](#laravel-formforge)

[![Laravel](https://camo.githubusercontent.com/afca9778e22c472c6b601fe4bac81424fb1b47a876c1742009544a6bce5c2e38/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d6164655f776974682d4c61726176656c2d7265643f7374796c653d666f722d7468652d6261646765)](https://laravel.com)[![License](https://camo.githubusercontent.com/7b032738aeb4a8dd7ec78c4402e078ca8c196b0e528c117bbd78088c9a036988/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75653f7374796c653d666f722d7468652d6261646765)](LICENSE)

Laravel FormForge is a PHP-first form builder for Laravel applications.

It lets you define forms as classes, build fields in PHP, render Bootstrap-friendly markup from Blade, validate with standard Laravel rules, and optionally hydrate Eloquent models from request data.

Contents
--------

[](#contents)

- [Why FormForge](#why-formforge)
- [Requirements](#requirements)
- [Installation](#installation)
- [Published Assets and Resources](#published-assets-and-resources)
- [Front-End Requirements](#front-end-requirements)
- [Quick Start](#quick-start)
- [Rendering in Blade](#rendering-in-blade)
- [Validation](#validation)
- [Hydrating Models From Request Data](#hydrating-models-from-request-data)
- [Form Lifecycle](#form-lifecycle)
- [FormBuilder API](#formbuilder-api)
- [Component Overview](#component-overview)
- [Buttons](#buttons)
- [Configuration](#configuration)
- [Events](#events)
- [Documentation Map](#documentation-map)

Why FormForge
-------------

[](#why-formforge)

FormForge is designed for applications where forms are part of your backend domain layer, not just loose Blade markup.

It is useful when you want:

- reusable form classes for create and edit flows,
- one place for field definitions and validation rules,
- request and model autofill behavior,
- consistent rendering across many forms,
- select, date, tooltip, and file helpers out of the box,
- a package that still feels close to normal Laravel conventions.

Requirements
------------

[](#requirements)

- PHP `^8.3`
- `illuminate/support` `^9.0|^10.0|^11.0|^12.0`
- `mews/purifier` `^3.4`

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

[](#installation)

Install the package:

```
composer require damianulan/laravel-form-forge
```

Laravel package discovery registers the service provider automatically.

Publish everything:

```
php artisan vendor:publish --tag=formforge
```

Or publish only the parts you need:

```
php artisan vendor:publish --tag=formforge-config
php artisan vendor:publish --tag=formforge-langs
php artisan vendor:publish --tag=formforge-views
php artisan vendor:publish --tag=formforge-resources
```

Published Assets and Resources
------------------------------

[](#published-assets-and-resources)

Publishing `formforge` or `formforge-resources` copies package front-end files to:

- `resources/vendor/formforge/style`
- `resources/vendor/formforge/js`

Publishing `formforge-config` creates:

- `config/formforge.php`

Publishing `formforge-views` creates:

- `resources/views/vendor/formforge`

Publishing `formforge-langs` creates:

- `lang/vendor/formforge`

The `formforge` tag also publishes the package stub to `stubs/form.stub`.

Front-End Requirements
----------------------

[](#front-end-requirements)

FormForge renders server-side HTML, but some components expect front-end helpers for the final experience.

The shipped assets integrate with:

- jQuery
- `chosen-js`
- `flatpickr`
- `tippy.js`
- Bootstrap-style markup/classes
- Bootstrap Icons for tooltip icons

Include the package stylesheet in your main stylesheet:

```
@import "resources/vendor/formforge/style/_formforge";
```

You can customize package variables in:

```
resources/vendor/formforge/style/_variables.scss

```

Before your main JS bundle, print the package runtime variables:

```
@formForgeScripts

```

This injects localized values used by the package JavaScript, including:

- select placeholders,
- select "no results" text,
- configured date format,
- configured time format,
- configured datetime format.

After publishing or updating package resources, rebuild your front-end assets.

Quick Start
-----------

[](#quick-start)

Generate a form class:

```
php artisan make:form CampaignForm
```

Generated form classes live in `App\Forms` and extend `FormForge\Base\Form`.

Example form:

```
