klapuch / form
Highly customizable forms in multiple formats
Installs: 1 369
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- klapuch/csrf: ^2.0.0
- klapuch/markup: ^2.0.0
- klapuch/validation: ^2.0.0
Requires (Dev)
- consistence/coding-standard: ^1.0
- jakub-onderka/php-parallel-lint: ^0.9.2
- mockery/mockery: ^0.9.9
- nette/tester: ^1.7
- phing/phing: ^2.16
- phpstan/phpstan: ^0.7.0
- sebastian/phpcpd: ^3.0
- slevomat/coding-standard: ^2.3
README
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') );