Skip to content
vlakoff edited this page Jul 8, 2017 · 18 revisions

Former is used as a View helper – it provides 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:

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

Former uses a fluent interface for building up form objects. Former objects don't actually function until they are cast to a string or ->render()'d.

Clone this wiki locally