<commit_before>fieldwork
===========
**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**.

### Installation

```bash
# navigate to your plugin folder
cd wp-content/plugins

git clone https://github.com/jmversteeg/fieldwork.git
cd fieldwork
composer install --no-dev
npm install
bower install
gulp
```

### Creating a simple form

```php
use fieldwork\Form;
use fieldwork\methods\POST;
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
   ->setGlyphIcon('right-open')
   ->addTo($contactForm);

// Output the form
echo $contactForm->getHTML();
```

#### todo

 - Error message i18n
 - Custom layout markups (perhaps through a proprietary HTML derivative)
 - Add ability to run sanitization, validation and callbacks through AJAX
 - Complete test coverage
 - Add continuous integration
 
#### 4.1.0 (2015-03-17)
 - Various bugfixes
 - Documentation improvement
 - Added some utility methods

#### 4.0.2 (2015-02-12)
 - Add PHPunit test framework
 - Remove foreign error message strings
 - Use external libraries for email and IBAN validation

#### 4.0.1 (2015-02-11)
 - Move /lib to /src/fieldwork
<commit_msg>Improve the README.md example<commit_after>fieldwork
===========
**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**.

### Installation

```bash
# navigate to your plugin folder
cd wp-content/plugins

git clone https://github.com/jmversteeg/fieldwork.git
cd fieldwork
composer install --no-dev
npm install
bower install
gulp
```

### Creating a simple form

```php
use fieldwork\Form;
use fieldwork\methods\POST;
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
   ->setGlyphIcon('right-open')
   ->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
 - Custom layout markups (perhaps through a proprietary HTML derivative)
 - Add ability to run sanitization, validation and callbacks through AJAX
 - Complete test coverage
 - Add continuous integration
 
#### 4.1.0 (2015-03-17)
 - Various bugfixes
 - Documentation improvement
 - Added some utility methods

#### 4.0.2 (2015-02-12)
 - Add PHPunit test framework
 - Remove foreign error message strings
 - Use external libraries for email and IBAN validation

#### 4.0.1 (2015-02-11)
 - Move /lib to /src/fieldwork

{'fraction_non_alphanumeric': 0.11538461538461539, 'fraction_numerical': 0.018069179143004648, 'mean_word_length': 4.450070323488045, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1386171', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1061, 'n_words': 406}