SPHPlayground API
SPHPlayground
sphplayground sphplayground

DATA VALIDATION: Introduction

User input validation is a critical part of any responsive HTML application.

Input validation is performed to ensure only properly formed data is entering the workflow in an information system. Validation should happen as early as possible in the data flow, preferably as soon as the data is received from the external party. Data from all potentially untrusted sources should be subject to input validation. [1]

This Framework contains its own user input validation mechanism which includes both server- and clientside components. This section is about the serverside validation mechanisms.

The cornerstone of serverside validation in this framework is the Validator interface. This interface defines the minimum properties required for any validator classes.

Predefined errormessage Template formatting parameters:

  1. :value - the string representation of the validated $value
  2. :type - the datatype of the validated $value
    1. :type = "boolean" - for boolean type
    2. :type = "integer" - for integer type
    3. :type = "float" - for float type
    4. :type = "string" - for string type
    5. :type = "array" - for array type
    6. :type = "object" - for object type
    7. :type = "resource" - for resource type
    8. :type = "resource (closed)" - for closed resource type
    9. :type = "NULL" - for nulls
    10. :type = "unknown type" - for unknown types
  3. :strict-type - the strict datatype of the validated $value differs from :type
    1. any object corresponds to the name of the class get_class() results
Synopsis

interface Validator