PHPackages                             livecms/forms - 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. livecms/forms

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

livecms/forms
=============

Live CMS Forms

v0.0.1(7y ago)1135MITPHP

Since Jul 22Pushed 7y ago1 watchersCompare

[ Source](https://github.com/livecms/forms)[ Packagist](https://packagist.org/packages/livecms/forms)[ Docs](https://github.com/livecms/forms)[ RSS](/packages/livecms-forms/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Welcome to Laravel Form Component For Laravel 5.5 or above
==========================================================

[](#welcome-to-laravel-form-component-for-laravel-55-or-above)

What is ?
---------

[](#what-is-)

This package can make form component (ie. textbox, select, radio, checkbox) based on array of setting.

Besides that, You can also create your own component consist of html and javascript.

Features
--------

[](#features)

- All benefits of LaravelCollective HTML packages
- Create form and the components based array of settings
- Support Jquery Validation
- Available Components that ready to use :
    - Textbox
    - Telephone
    - Number
    - Email
    - Password
    - Textarea
    - Checkbox
    - Radio
    - Select
    - Select2
    - Image
    - Boolean (Radio button with Yes/No options)
- Define your own component
- Define your own validation script

### Notes

[](#notes)

- You need add [Jquery Validation](https://jqueryvalidation.org) to use default validation properly, but you can use your own script. See [Custom Validation Section](#custom-validation).
- Add [Select2 Files](https://select2.org/) if you want to use Select2 Component

How to use?
-----------

[](#how-to-use)

### Install via composer

[](#install-via-composer)

```
composer require livecms/forms
```

### Publish config file :

[](#publish-config-file-)

```
php artisan vendor:publish --provider="LiveCMS\Form\FormServiceProvider"
```

Edit 'form.php' config file.

### Creating form :

[](#creating-form-)

```
// controller

use LiveCMS\Form\Forms;

$form = Forms::create()->setComponents([...])->render();

// view
{!! Form::open(['url' => '/your/route']) !!}
{!! $form !!}
{!! Form::close() !!}

{!! Form::javascript()  !!}

```

### Set in form :

[](#set--in-form-)

it has same arguments for Form::open() in [LaravelCollective HTML](https://laravelcollective.com/docs/5.2/html#opening-a-form)

```
// controller
$form = Forms::create(['url' => '/your/route', 'method' => 'PUT', 'class' => 'form-inline'])
            ->setComponents([...])
            ->render();

// view
{!! $form !!}

{!! Form::javascript()  !!}

```

### You can create multiple forms and set a name for each form :

[](#you-can-create-multiple-forms-and-set-a-name-for-each-form-)

```
// controller
Forms::create([...])->setComponents([...])->setName('form1');
Forms::create([...])->setComponents([...])->setName('form2');

// view
{!! Form::render('form1') !!}
{!! Form::render('form2') !!}

{!! Form::javascript()  !!}

```

### Available components :

[](#available-components-)

you can see the files in folder :

```
/vendor/livecms/forms/src/Components

```

- Textbox, type : 'text'
- Telephone, type : 'tel'
- Number, type : 'number'
- Email, type : 'email'
- Password, type : 'password'
- Textarea, type : 'textarea'
- Checkbox, type : 'checkbox'
- Radio, type : 'radio'
- Select, type : 'select'
- Select2, type : 'select2'
- Image, type : 'image'
- Boolean, type : 'boolean'

### How to use components :

[](#how-to-use-components-)

```
$components = [
    'comp1' => [
        'type' => 'text', // required
        'label' => null, // optional
        'value' => null, // optional
        'default' => null, // optioal
        'options' => [], // optional and this only for checkbox, radio, select, select2
        'attributes' => [], // optional
    ],
    ...
    'comp-n' => [
        'type' => 'select',
        'options' => [
            'one', 'two', 'three',
        ],
        'attributes' => [
            'required' => true,
            'class' => 'input-select',
        ]
    ]
];

Form::create([...])->setComponents($components)->setName('form1');
```

### Add global properties :

[](#add-global-properties-)

```
Forms::create([...])
    ->setComponents([...])
    ->addGlobalProperties([
        'required' => '*', // implemented to all components, you can use empty array []
        'class:input-select' => ['province', 'city', 'region'],
        'data-image:landscape' => ['image', 'cover'],
    ])
    ->setName('form1');

// the result all of defined components will get what you write in key of the array
// example for : 'data-image:landscape' => ['image', 'cover']
// the result  :
/**
 *
 *
 */
```

### Add custom component :

[](#add-custom-component-)

- Create a Class, you can extends a class from 'LiveCMS\\Form\\Components\\BaseComponent' class in ```
    /vendor/livecms/forms/src/Components/BaseComponent.php

    ```

    Since it contains an abstract method render(), you have to define your own render() method. You can also see the example from available components or extends from it. See all files in folder ```
    /vendor/livecms/forms/src/Components

    ```
- Define your custome components in 'form' config file : ```
    'components' => [
        'text' => \App\Forms\CustomeTextbox::class,
        'image' => \App\Forms\CustomeImage::class,
    ],

    ```

### Use Validation Script

[](#use-validation-script)

```
Forms::create([...])->setComponents([...])->useValidation()->setName('form1');
```

You can disable validation by :

```
Forms::create([...])->setComponents([...])->useValidation(false)->setName('form1');
```

**Note** : by default, validation script require jquery validation js

### Custom Validation

[](#custom-validation)

- Create your own javascript file
- Define it in 'form' config file : ```
        'scripts' => [
            'validation' => '/path/to/javascript/file',
        ],
    ```

### Add custom scripts

[](#add-custom-scripts)

- Create your own javascript file
- Define it in 'form' config file, but use other name despite 'validation' because it is reserved only for validation : ```
        'scripts' => [
            'validation' => '/path/to/javascript/file',
            'customscript' => '/path/to/javascript/file',
        ],
    ```
- Call it ```
    Forms::create([...])->setComponents([...])->addScript('customscript')->setName('form1');
    ```

If you want to cancel adding script, fill second argument with 'false':

```
->addScript('script_name', false)
```

### Fill form with datas

[](#fill-form-with-datas)

```
$components = [
    'name' => ['type' => 'text'],
    'email' => ['type' => 'email'],
];
$datas = ['name' => 'Mokhamad Rofiudin', 'email' => 'mokh@rofiudin.com'];
Form::create([...])
    ->setComponents($components)
    ->fill($datas)
    ->setName('form1')
    ->render();
```

LICENSE
-------

[](#license)

MIT

CONTRIBUTING
------------

[](#contributing)

Fork this repo and make a pull request

ISSUE AND DISCUSSION
--------------------

[](#issue-and-discussion)

Please create new issue or see the closed issues too.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2902d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7432391?v=4)[Mokhamad Rofiudin](/maintainers/mrofi)[@mrofi](https://github.com/mrofi)

---

Top Contributors

[![mrofi](https://avatars.githubusercontent.com/u/7432391?v=4)](https://github.com/mrofi "mrofi (30 commits)")

---

Tags

formformbuilderlaravel

### Embed Badge

![Health badge](/badges/livecms-forms/health.svg)

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

###  Alternatives

[patricktalmadge/bootstrapper

Twitter Bootstrap markup generator

555412.9k4](/packages/patricktalmadge-bootstrapper)[nwidart/laravel-menus

Laravel Menu management

171182.1k10](/packages/nwidart-laravel-menus)[pingpong/menus

Laravel Menus

70241.3k13](/packages/pingpong-menus)[akaunting/laravel-menu

Menu and sidebar management package for Laravel

38254.2k](/packages/akaunting-laravel-menu)[caouecs/sirtrevorjs

Sir Trevor JS in Laravel project

5421.6k](/packages/caouecs-sirtrevorjs)[rinvex/laravel-menus

Rinvex Menus is a simple menu builder package for Laravel, that supports hierarchical structure, ordering, and styling with full flexibility using presenters for easy styling and custom structure of menu rendering.

304.0k20](/packages/rinvex-laravel-menus)

PHPackages © 2026

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