Download the PHP package tamedevelopers/validator without Composer
On this page you can find all versions of the php package tamedevelopers/validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download tamedevelopers/validator
More information about tamedevelopers/validator
Files in tamedevelopers/validator
Download tamedevelopers/validator
More information about tamedevelopers/validator
Files in tamedevelopers/validator
Vendor tamedevelopers
Package validator
Short Description PHP Form Validator is a small no-depencies library for PHP codes.
License MIT
Homepage https://github.com/tamedevelopers/validator
Package validator
Short Description PHP Form Validator is a small no-depencies library for PHP codes.
License MIT
Homepage https://github.com/tamedevelopers/validator
Please rate this library. Is it a good library?
Informations about the package validator
PHP Form Validator - PFV
Documentation
- Requirements
- Installation
- Instantiate
- Laravel Support
- Methods That Should Always Come First
- Global Configuration
- Csrf
- Csrf Form Input
- Csrf Token
- Usage
- Error Type
- Token
- POST
- GET
- ALL
- ANY
- Rules
- Validate
- Save
- Data Types
- Operators
- noInterface
- Before
- After
- Has Error
- Is Validated
- Reset Error
- Only
- Except
- Has
- Old
- Merge
- Only Data
- Except Data
- GetForm
- Get Message and Class
- Collection
- Collection Methods
- toObject
- toArray
- toJson
- Helpers
- Useful links
Requirements
>= php 8.0+
Installation
Prior to installing validator package get the Composer dependency manager for PHP because it'll simplify installation.
Instantiate — Instantiate class using
- or --
Helpers Function
Laravel Support
- Now supports Laravel and with same Functionalities no different
use Tamedevelopers\Validator\Validator;
Methods That Should Always Come First
- All are Optional
method- These methods are only mandatory on usage and should always come first before others.
| Methods | Description |
|---|---|
| ->errorType() | bool to format error's on display: single or multiple |
| ->token() | bool to Enable or Disable csrf_token for each request |
| ->post() | Convert Form request to POST only |
| ->get() | Convert Form request to GET only |
| ->all() | Convert Form request to any |
Global Configuration
- Helpers available to assist on easy configuration
config_form()
| Keys | Description |
|---|---|
| request | String POST\|GET\|ALL Default POST |
| error_type | Boolean true\|false Default false |
| csrf_token | Boolean true\|false Default true |
| class | Assoc Array error\|success error class type to be returned on both success and failure |
Csrf
- Implementing
Csrf(Cross-Site Request Forgery)- By default the form requires all request to have a token attached.
- You can disable the usage with the
config_form()Helper
- You can disable the usage with the
- By default the form requires all request to have a token attached.
Csrf Form Input
- This will create html input element with valid
csrf token- It's a function and you don't need to
echo- Use anywhere inside your HTML form
- It's a function and you don't need to

Csrf Token
- This will return the
csrf tokenstring
USAGE
- All Methods of usage
Error Type
- Takes a param as
boolDefault isfalse- You can call separately or Call Before any other method, if intend to use.
| Error | Description |
|---|---|
| false | Default Errors displayed one after another |
| true | This allow all errors to be displayed once, as an array |
Token
- Takes a param as
boolDefault isfalse- Allow disability of
csrf_tokenon each form request
- Allow disability of
| Error | Description |
|---|---|
| false | Default Will disable csrf_token usage |
| true | This allow csrf_token per request only |
POST
- Set the Form Request to
POST- This will always override the
config_form()settings
- This will always override the
GET
- Set the Form Request to
GET
All
- Will automatically detect if request type is
GET\|POSTand get it's data.
Any
- same as
all
Rules
- By default only
DATA TYPEand[INPUT_NAME]is required- Always seperate each indicator with a 'colon'
:or 'pipe'|
- Always seperate each indicator with a 'colon'
| DATA TYPE | INPUT_NAME | COMPARISON OPERATOR | VALUE TO COMPARE |
|---|---|---|---|
| string | : country | : == | : 0 |
| : |
- HTML FORM Structure
Validate
- Takes an [optional]
closurefunction as the param
Save
- Expects a
closurefunction as the param- Message property will be empty string on success
$response->message
- Message property will be empty string on success
Data Types
Supports 9 Data Flags type
| Data types | abbr | Description |
|---|---|---|
| e | Email data validation |
|
| bool | b | Boolean data validation |
| string | s | String data validation |
| str_len | sl | String Length validation |
| enum | en | Enum Forms checkbox \| radio or any form data that normally has no value when not checked |
| array | a | Array data validation |
| float | f | Float data validation |
| int | i | Int data validation |
| url | u | Url data validation |
Operators
Supports 10 operational statement
| sign | Description |
|---|---|
| == | Equal to |
| === | Strictly Equal to |
| != | Not Equal To |
| !== | Not Strictly Equal To |
| > | Greater than |
| >= | Greater than or Equal to |
| < | Less than |
| <= | Less than or Equal to |
| < or > | Less than or Greater than |
| < and > | Less than and Greater than |
noInterface
- Expects a
closurefunction as the param- have access to form data without any validation
Before
- Expects a
closurefunction as the param- Will only execute code within when Request is [GET]
- CSRF Token
does'ntapply to this method
- CSRF Token
- Will only execute code within when Request is [GET]
After
- Expects a
closurefunction as the param- Will always execute no matter the request method type
- CSRF Token
does'ntapply to this method
- CSRF Token
- Will always execute no matter the request method type
Has Error
- Returns bool
true\|false
Is Validated
- Returns bool
true\|false, When Form has already been validated
Reset Error
- Even if you're inside the
success() method - With this helper, you can be able to reset the class, to error class
Only
- Takes a param as an
arraykeysof data only needed, from theform param
Except
- Exact opposite of
only()method
Has
- Takes a param as
stringinput name- Returns boolean as
true|\false
- Returns boolean as
Old
-
Takes a param as
stringand return old inserted data- Second parameter is [optional]
mixed data.
- Second parameter is [optional]
- or --
Helpers Function

GetForm
- Return all submitted form data as an
array
Merge
- Same as PHP function
array_merge- Merge two array data together
- Second data will always repalace any matched key data in the first array
Only Data
- Return only
data passedfrom set of given array elements.
| Keys | Data |
|---|---|
array |
Main data to select from |
Except Data
- Exact opposite of
onlyData()method
| Keys | Data |
|---|---|
| Keys are array | Main data to select from |
Get Message and Class
| key | Description |
|---|---|
| message | Message This convert all error messages and return as a string with <br> |
| class | Class name Class name on error and success |

Collection
- Forms
paramreturns a Collection Class- This enable us access property as an
objectorarray index
- This enable us access property as an
Collection Methods
| Methods | Description |
|---|---|
| toArray() | array Convert items to array |
| toObject() | object Convert items to object |
| toJson() | string Convert items to json |
toObject
- Takes a param as
mixeddata- Converts to an
Objectdata
- Converts to an
toArray
- Takes a param as
mixeddata- Converts to an
Arraydata
- Converts to an
toJson
- Takes a param as
mixeddata- Converts to an
Jsondata
- Converts to an
Helpers
| function | Description |
|---|---|
| old() | Inherit instance of (new Validator) old() method |
| form() | Return instance of (new Validator) class |
Useful links
- @author Fredrick Peterson (Tame Developers)
- Lightweight - PHP Form Validator
- If you love this PHP Library, you can Buy Tame Developers a coffee
- Link to Youtube Video Tutorial on usage will be available soon
All versions of validator with dependencies
PHP Build Version
Package Version
The package tamedevelopers/validator contains the following files
Loading the files please wait ....