Skip to content

Extract information from your form templates for use with validators, verifiers etc

Notifications You must be signed in to change notification settings

laverboy/form-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Form Parser

A simple utility to read a form template and pull out information useful to validators and from verifiers.

**Not Yet - Installation

// $ composer require laverboy/form-parser

Usage

<?php

use FormParser\FormParser;

// read a new template
$fp = new FormParser('../contact-form.php');

// check for the existence of a field
$fp->inputExists('firstname'); // returns true or false

// find all the required fields
$fp->getRequiredFields(); // returns ['firstname', 'lastname', 'email'];

// find all the email fields
$fp->getEmailFields(); // returns array

// find all the labels (labels need to have a 'for' attribute)
$fp->getLabels(); // returns array 

Todo

  • test with php generated forms
  • test labels with array named fields

About

Extract information from your form templates for use with validators, verifiers etc

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages