An open API service indexing awesome lists of open source software.

https://github.com/refkinscallv/fvss

PHP Form Validation Server-Side
https://github.com/refkinscallv/fvss

form-validation php php-library request-validator validation-library validation-tool

Last synced: 12 months ago
JSON representation

PHP Form Validation Server-Side

Awesome Lists containing this project

README

          

# FVSS - Form Validation Server-Side for PHP

FVSS (Form Validation Server-Side) is a PHP library designed to streamline and simplify the process of server-side form validation. It offers a comprehensive set of validation functions catering to common input data types found in web forms. FVSS ensures that the data submitted by users adheres to predefined criteria, enhancing the security and reliability of form submissions.

## Features

- **Validation Types:**
- `alphanum` (Alphabet & Numeric Format)
- `alpha` (Alphabet Format)
- `num` (Numeric Format)
- `date` (Date Format)
- `datetime` (Date & Time Format)
- `time` (Time Format)
- `email` (Email Format)
- `url` (URL Format)
- `domain` (Domain Format)
- `ip` (IP Format)

- **Additional Parameters:**
- `space`: Allowing or disallowing spaces in the values.
- `length`: Specifying the minimum length for certain types of validation.
- `punct`: Allowing or disallowing punctuation marks in the values.

## Installation

Install FVSS using Composer:

```bash
composer require refkinscallv/fvss
```

## Usage Example

```php
"Jhon Doe",
"label" => "Name",
"type" => "alpha",
"length" => false,
"space" => true,
"punct" => false,
], [
"value" => "0888888888",
"label" => "Phone Number",
"type" => "num",
"length" => 10, // minimum length
"space" => false,
"punct" => false,
], [
"value" => "2000-02-09",
"label" => "Date of Birth",
"type" => "date",
"length" => false,
"space" => false,
"punct" => false,
], [
"value" => "mail@mail.com",
"label" => "Email",
"type" => "email",
"length" => false,
"space" => false,
"punct" => false,
], [
"value" => "https://www.facebook.com",
"label" => "Social Media URL",
"type" => "url",
"length" => false,
"space" => false,
"punct" => false,
]
];

// Validation process
$validate = $fvss->validate($req);

// Output of the validation process is a boolean: true or false
// If the output is false, then the $validate->message object variable will have the value of the error message
if ($validate->status) {
echo "So far so good";
} else {
echo $validate->message;
}
```