PHPackages                             ilyasavich/form-builder - 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. ilyasavich/form-builder

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

ilyasavich/form-builder
=======================

The form builder service for laravel app

v1.1.3(7y ago)143MITPHP

Since Mar 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/IlyaSavich/laravel-form-builder)[ Packagist](https://packagist.org/packages/ilyasavich/form-builder)[ RSS](/packages/ilyasavich-form-builder/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (23)Used By (0)

Laravel Form Builder
====================

[](#laravel-form-builder)

The form builder service for Laravel

Installation
============

[](#installation)

### Require

[](#require)

```
composer require ilyasavich/form-builder

```

### Register Provider and Facade

[](#register-provider-and-facade)

```
in app.php config

'providers' => [
    // ...
    Savich\FormBuilder\FormServiceProvider::class,
],

```

### Publish config

[](#publish-config)

```
php artisan vendor:publish --provider="Savich\FormBuilder\FormServiceProvider" --tag=config

```

Usage
=====

[](#usage)

To create new form first of all extending base `Form` class and overwrite method `make`. This method implements form building logic

```
use Savich\FormBuilder\Form;
use Savich\FormBuilder\FormBuilder;

class UserForm extends Form
{
    protected function make(FormBuilder $builder): FormBuilder
    {
    }
}

```

### Create inputs

[](#create-inputs)

The package provide to create all available html inputs. To add new input in your form class you need call `add` method of builder instance. It signature

```
public function add(string $inputNamespace, string $name, $value = null, array $options = []) : Input

```

To create simple input write ...

```
use Savich\FormBuilder\Form;
use Savich\FormBuilder\FormBuilder;
use Savich\FormBuilder\Inputs\EmailInput;

class UserForm extends Form
{
    protected function make(FormBuilder $builder): FormBuilder
    {
        $builder->add(EmailInput::class, 'email');
    }
}

```

Customization
-------------

[](#customization)

### Attributes

[](#attributes)

Here are several methods to customize input

```
// you can set input attributes in different ways
// also you can specify default input value

$value = 'Hello World!';
$attributes = ['class' => 'form-control'];
$builder->add(TextInput::class, 'input_name', $value)->attributes($attributes);
$builder->add(TextInput::class, 'input_name', $value, $attributes);

```

### Labels

[](#labels)

```
$builder->add(TextInput::class, 'input_name')->label('My Label');

```

### Group customization

[](#group-customization)

By default inputs will generating in such format

```
$builder->add(TextInput::class, 'input_name');

// generated view

```

If you don't need to wrap input by group

```
$builder->add(TextInput::class, 'input_name')->withoutGroup();

// generated view

```

You can customize group attributes

```
$builder->add(TextInput::class, 'input_name')->groupAttributes(['class' => 'my-class', 'inputID']);

// generated view

```

### Overwrite views

[](#overwrite-views)

If you need specific input generating you can overwrite default view by your custom

```
$builder->add(TextInput::class, 'input_name')->view('path.to.view');

```

In case where you need to overwrite view without group you can ...

```
//this will overwrite code inside form-group div
$builder->add(TextInput::class, 'input_name')->internalView('path.to.view');

```

When you need to overwrite only group you can ... In view you have `$input` object that is an instance of your input class.

```
$builder->add(TextInput::class, 'input_name')->view('path.to.view');

// in resources.views.path.to.view
// in withoutGroupView there path to internal view, you can specify custom or there will be default
generateGroupAttributes() !!}>
    // write custom stuff ...
    @include($input->withoutGroupView)

```

### Available input properties

[](#available-input-properties)

The you can find list of available properties of `$input` object

NameDescription`$name`Input name`$value`Input value`$attributes`Input attributes`$label`Input label in html`$view`Path to input group view. Will be `null` if you don't set it in `view()` method`$defaultView`Path to default group view. You can set it in config file`$groupAttributes`Array of group attributes`$before`Array of inputs that must be inserted inside group before current`$after`Array of inputs that must be inserted inside group after current`$withoutGroup`Can be set by call `withoutGroup()` method. Indicates that need generate input without wrapping group`$withoutGroupView`Path to view inside group`$model`Model that will be binding for input### Create simple form

[](#create-simple-form)

For example you need to create simple login form with at least two inputs. Ok, it will something like that

```
use Savich\FormBuilder\Form;
use Savich\FormBuilder\FormBuilder;

class LoginForm extends Form
{
    protected function make(FormBuilder $builder)
    {
        $builder->email('email')->label('Email');
        $builder->password('password')->label('Password');

        $builder->submit('Save');
    }
}

```

After that you need to add this form in controller action

```
class LoginController extends Controller
{
    public function showLoginForm(LoginForm $form)
    {
        $formHtml = $form->create();

        return view('login')->with('form', $formHtml);
    }
}

```

And, finally, render form in view file

```
in resources/views/login.blade.php

{!! $form !!}

```

Lets create action for submitting login form. In our controller

```
class LoginController extends Controller
{
    // ...

    public function login(LoginForm $form)
    {
        $form->request(); // access to request

        // login logic
    }
}

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~23 days

Recently: every ~18 days

Total

22

Last Release

2841d ago

Major Versions

v0.0.4 → v1.0.02017-04-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/1a36e7005b1509f46282acfe311b0c016a263ec7a7b4d9ae0c89ae1fa7d32c7c?d=identicon)[IlyaSavich](/maintainers/IlyaSavich)

---

Top Contributors

[![IlyaSavich](https://avatars.githubusercontent.com/u/12517348?v=4)](https://github.com/IlyaSavich "IlyaSavich (26 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ilyasavich-form-builder/health.svg)

```
[![Health](https://phpackages.com/badges/ilyasavich-form-builder/health.svg)](https://phpackages.com/packages/ilyasavich-form-builder)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[boomcms/boom-core

Core classes for BoomCMS

193.0k6](/packages/boomcms-boom-core)

PHPackages © 2026

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