Skip to content
Maxime Fabre edited this page Jul 24, 2013 · 18 revisions

Getting started

Core concept

Former is to be used as a View helper – meaning it provides for you a class that you can use directly in your views to output HTML code.

<?= Former::open()->method('GET') ?>
	<?= Former::text('name')->required() ?>
<?= Former::close() ?>

If you're using Twig or other more closed view templating systems, you can still use Former's classes outside :

```php
$form = Former::open()->method('GET');
	$form .= Former::text('name')->required();
$form .= Former::close();

Installation

Under Laravel 3

Clone the laravel3 branch of the repo in your bundles folder and add 'former' => array('auto' => true) to your bundles file. Then add as an alias 'Former' => 'Former\Facades\Former' in your application file and you're good to go !

Under Laravel 4

Installing Former is easy as hell. Add the following to your composer.json :

"anahkiasen/former": "dev-master"

Add Former's service provider to your Laravel application in app/config/app.php. In the providers array add :

'Former\FormerServiceProvider',

Add then alias Former's main class by adding its facade to the aliases array in the same file :

'Former' => 'Former\Facades\Former',

With Package installer

Simply do artisan package:install anahkiasen/former:dev-master

Outside of a framework

Same as for Laravel 4, add Former to your Composer file. Then do this :

use Former\Facades\Former;

And you're done.

Clone this wiki locally