PHPackages                             talentasia/form - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. talentasia/form

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

talentasia/form
===============

A basic framework agnostic form building package with a few extra niceties like remembering old input and retrieving error messages.

0.1(8y ago)0651MITPHPPHP &gt;=5.4.0

Since Aug 3Pushed 8y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (4)Versions (2)Used By (1)

Form
====

[](#form)

Boring name for a boring package. Builds form HTML with a fluent-ish, hopefully intuitive syntax.

- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Remembering Old Input](#remembering-old-input)
- [Error Messages](#error-messages)
- [CSRF Protection](#csrf-protection)
- [Data Binding](#data-binding)

[](#installation)

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

[](#installation)

You can install this package via Composer by running this command in your terminal in the root of your project:

```
composer require talentasia/form
```

### Laravel

[](#laravel)

> This package works great as a replacement Form Builder that was removed in Laravel 5. The API is different but all of the features are there.

If you are using Laravel 4 or 5, you can register the FormServiceProvider to automatically gain access to the Old Input and Error Message functionality.

To do so, just update the `providers` array in your `config/app.php`:

```
'providers' => [
        //...
        'TalentAsia\Form\FormServiceProvider'
    ],
```

You can also choose to use the Facade by adding an alias in `config/app.php`:

```
'aliases' => [
        //...
        'Form' => 'TalentAsia\Form\Facades\Form',
    ],
```

> Note that in Laravel 4, there is already a Form facade for the built-in Form Builder. If you want to use both, use a different alias. If you'd just like to use this one, remove the Form alias that points to the Illuminate component.

[](#basic-usage)

Basic Usage
-----------

[](#basic-usage)

- [Getting Started](#getting-started)
- [Opening a Form](#opening-a-form)
- [Text and Password Fields](#text-and-password-fields)
- [Textareas](#textareas)
- [Checkboxes and Radio Buttons](#checkboxes-and-radio-buttons)
- [Selects](#selects)
- [Buttons](#buttons)
- [Hidden Inputs](#hidden-inputs)
- [Labels](#labels)
- [Setting Attributes](#setting-attributes)

[](#getting-started)

### Getting Started

[](#getting-started)

First, instantiate a FormBuilder...

```
$builder = new TalentAsia\Form\FormBuilder;
```

Next, use the FormBuilder to build an element. For example:

```
//
