Skip to content
This repository has been archived by the owner on Nov 8, 2020. It is now read-only.

klapuch/Form

Repository files navigation

Form

Build Status Build status Coverage Status

Documentation

Installation

composer require klapuch/form

Usage

Form

new Form\RawForm(
	[
		'method' => 'POST',
		'role' => 'form',
		'class' => 'form-horizontal',
		'action' => '/process.php',
		'name' => self::NAME,
	],
	new Form\CsrfInput($this->csrf)
);

Select with options

new Form\Select(
	new Form\FakeAttributes(['name' => 'fruit']),
	new Form\Option(
		new Form\DependentAttributes(['value' => 'apple'], $this->storage, 'fruit'),
		'Apple',
		new Validation\OneOfRule(['apple', 'berry'])
	),
	new Form\Option(
	new Form\DependentAttributes(['value' => 'berry'], $this->storage, 'fruit'),
	'Berry',
	new Validation\OneOfRule(['apple', 'berry'])
	)
);

Input with label

new Form\BoundControl(
	new Form\Input(
		new Form\StoredAttributes(
			[
				'type' => 'email',
				'name' => 'email',
				'class' => 'form-control',
				'required' => 'required',
			],
			$this->storage
		),
		new Constraint\EmailRule()
	),
	new Form\LinkedLabel('Email', 'email')
);

About

Highly customizable forms in multiple formats

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages