2017 © Pedro Peláez
 

library php-form-processor

Create webforms on your website in minutes. It has various built-in validation checks and is extendable to allow you to add more features.

image

pfp/php-form-processor

Create webforms on your website in minutes. It has various built-in validation checks and is extendable to allow you to add more features.

  • Friday, December 22, 2017
  • by Richard_Hung
  • Repository
  • 1 Watchers
  • 1 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

PHP Form Processor

PHP Form Processor allows you to create forms on your website in minutes. It has standard validation checks built in, and you can easily extend the various classes to add your own., (*1)

Features

  • A lot of standard validation checks
  • Easily extendable classes to create your own custom fields
  • Separated template files for easy altering of the form's HTML markup
  • Google reCAPTCHA integration

Documentation

The more in-depth features are explained with pages on the wiki, (*2)

Installation

PHP Form Processor is installed via Composer., (*3)

composer require pfp/php-form-processor

Initialization

After installing it through Composer, you will have to create your field parameters before initializing the form. For a full list of available fields and their parameters, please check out the list of fields page on the wiki., (*4)

$fields = array();

$fields['name'] = array(
    'label'    => 'Name',
    'type'     => 'text',
    'required' => true,
    'name'     => 'name',
);

$fields['email'] = array(
    'label'    => 'Email',
    'type'     => 'email',
    'required' => true,
    'name'     => 'email',
);

$fields['body'] = array(
    'label'    => 'Message',
    'type'     => 'textarea',
    'required' => true,
    'name'     => 'body',
);

$form_params = array(
    'fields' => $fields,
);

$form = new Pfp\PhpFormProcessor\form($form_params);

Display the form

After creating a new form object, you can print it out with the render_form method., (*5)

$form->render_form('submissions.php');

Submit the form

On the submissions page, you will have to initialize the form object again with the same parameters. You will also have to pass the form inputted data into the form in order for the validation functions to run., (*6)

$form->submit_form_data($_POST);

Validation

The plugin provides numerous validation checks to all the fields. See the full list of validation functions on the wiki., (*7)

Errors

If there are any errors after running the submit_form_data method, the errors and the submitted data is saved in the $_SESSION superglobal variable., (*8)

$form->print_errors();

Data Retrieval

Data is retrieved with the get_field_value method after submit_form_data. You will have to pass it the key from the fields array that was set during initialization., (*9)

$email = $form->get_field_value('email');

The Versions

22/12 2017

dev-master

9999999-dev https://github.com/Richard1320/php-form-processor

Create webforms on your website in minutes. It has various built-in validation checks and is extendable to allow you to add more features.

  Sources   Download

MIT

The Development Requires

php form form validation

22/12 2017

1.0.2

1.0.2.0 https://github.com/Richard1320/php-form-processor

Create webforms on your website in minutes. It has various built-in validation checks and is extendable to allow you to add more features.

  Sources   Download

MIT

The Development Requires

php form form validation

19/12 2017

1.0.1

1.0.1.0 https://github.com/Richard1320/php-form-processor

Create webforms on your website in minutes. It has various built-in validation checks and is extendable to allow you to add more features.

  Sources   Download

MIT

The Development Requires

php form form validation

05/05 2017

1.0.0

1.0.0.0 https://github.com/Richard1320/php-form-processor

Create webforms on your website in minutes. It has various built-in validation checks and is extendable to allow you to add more features.

  Sources   Download

MIT

The Development Requires

php form form validation

01/05 2017

0.1.3

0.1.3.0 https://github.com/Richard1320/php-form-processor

Create webforms on your website in minutes. It has various built-in validation checks and is extendable to allow you to add more features.

  Sources   Download

MIT

php form form validation

30/04 2017

0.1.2

0.1.2.0 https://github.com/Richard1320/php-form-processor

Create webforms on your website in minutes. It has various built-in validation checks and is extendable to allow you to add more features.

  Sources   Download

MIT

php form form validation

30/04 2017

0.1.1

0.1.1.0 https://github.com/Richard1320/php-form-processor

Create webforms on your website in minutes. It has various built-in validation checks and is extendable to allow you to add more features.

  Sources   Download

MIT

php form form validation

29/04 2017

0.1.0

0.1.0.0 https://github.com/Richard1320/php-form-processor

Create webforms on your website in minutes. It has various built-in validation checks and is extendable to allow you to add more features.

  Sources   Download

MIT

php form form validation