jmversteeg / fieldwork
Web forms for cool people
4.3.0
2015-06-22 14:25 UTC
Requires
- php: >=5.3
- egulias/email-validator: ~1.2
- jschaedl/iban: ~1.1
- rmccue/requests: ~1.6
Requires (Dev)
- aura/autoload: ~2.0
- phpunit/phpunit: 4.5.*
- satooshi/php-coveralls: 0.6.*
This package is not auto-updated.
Last update: 2025-03-12 18:21:44 UTC
README
Web forms for cool people
fieldwork will make your life easier by dealing with the trivial tasks of building web forms such as markup generation, validation and sanitization.
- Define entire forms using PHP only. All HTML and JavaScript code will be generated for you.
- Sanitizes and validates client-side for convenience + performance and server-side for security.
Creating a simple form
use fieldwork\Form; use fieldwork\components\TextField; use fieldwork\components\Button; use fieldwork\validators\EmailFieldValidator; // Instantiate a new form $contactForm = new Form('contactform'); // Add a text field with validation $emailField = new TextField('email', 'Email address'); $emailField ->addValidator(new EmailFieldValidator()) ->addTo($contactForm); // Add a submit button $submitButton = new Button('submit', 'Send', 'submit', Button::TYPE_SUBMIT); $submitButton ->addTo($contactForm); // Process the form $contactForm->process(); if($contactForm->isSubmitted()) echo 'Your email address is ' . $contactForm->v('email'); else echo $contactForm->getHTML();
TODO
- Error message i18n
- Tighter AJAX integration / API
- Complete test coverage
HEAD
- Moved the front-end assets into a separate repo
- Added NumberSanitizer
- Added materialize.css compatible markup generation
- Fixed some bugs