jonhoo/laravel-former

Laravel form library

0.4.1 2014-05-02 21:51 UTC

README

Former is a form library for Laravel that provides HTML5 form field types, validation and various other convenient luxuries for modern app development.

Build status: Build Status

Notes on usage until examples are in place

Former will validate all data that is passed to it, but will not change the array that is given to it. To avoid mass-assignment attacks and such, use

$form = new Form(/* ... */);
$form->setInput(Input::all());
$validator = $form->accept();
if (!$validator->fails()) {
  $data = $validator->getData();
  // Work with $data, NOT Input::all()!
}

Installing

  • Install Composer and place the executable somewhere in your $PATH (for the rest of this README, I'll reference it as just composer)

  • Add jonhoo/former to your project's `composer.json:

{
    "require": {
        "jonhoo/former": "0.*"
    }
}
  • Install/update your dependencies
$ cd my_project
$ composer install

And you're good to go! Have a look at the example files in examples/ to see how you might go about using Former.