Download the PHP package mahmoud-abdelfadeil/validator-filter-php without Composer
On this page you can find all versions of the php package mahmoud-abdelfadeil/validator-filter-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mahmoud-abdelfadeil/validator-filter-php
More information about mahmoud-abdelfadeil/validator-filter-php
Files in mahmoud-abdelfadeil/validator-filter-php
Package validator-filter-php
Short Description package to facilitate validation and filtering in PHP
License MIT
Informations about the package validator-filter-php
Validator And Filter PHP
package to facilitate validation and filtering in PHP
Created By : Mahmoud Abdelfadeil
install
Confige File
Validator
- Syntax
- NotesSyntax
- string
- url
- required
- options
- ip
- email
- max_length
- min_length
- max_val
- min_val
- uniqueAndExists
- unique
- exists
Filter
-string
-num_int
-num_float
-email
-url
-encoded
-magic_quotes
-special_char
installation
1- composer require mahmoud-abdelfadeil/validator-filter-php
ConfigeFile
create config file Through the following command :
php vendor/mahmoud-abdelfadeil/validator-filter-php/src/Validator/create-file-config.php
Or create a config file by writing these lines into the composer.json file , Then command composer dump-autoload
Then the file is created config/validator-filter-config.php
It is a settings file that makes settings for Database and language settings
Validate
It is intended to verify the value
There are several functions of them
Syntax
NotesSyntax
As we noticed in the previous example, we write the name of the request, then the rules to be verified, and each rule is separated by using the ' | '
There are many rules that we need to write a value, for example the max_length, which means the minimum number of characters, and the rule and value are separated using the ' : '
Rules
string
Check the value if it is textual or not
number
Check if the value is a number or not
url
Check if the value is a url or not
required
Check if the value is empty or not
options
It forces the user to enter the specified values into the options
From a rule that takes specified values but is written this way :
options:[option 1 , option 2 , .......]
ip
Check if the value is a ip or not
Check if the value is a email or not
max_length
Checks the maximum amount of characters allowed
min_length
Check the minimum number of characters allowed
example
max_val
Check the maximum allowed value
min_val
Check the minimum allowed value
Note:The max_length or min_length is used with the string. The max_val and min_val are used with numbers . In addition, they check if it is a number or not
uniqueAndExists
Before dealing with either of them, make the database settings from the config/validator-filter-config.php
unique
Verify that the value is not present in the data base
Synax :
unique:table,column
Here, verify that email does not already exist in Databases
If modified, the identifier is sent with the unique identifier to check all rows except for the sender and write in this way The id field name for example tbl_id and then the value that way tbl_id = 5
If the field is named id, you only need to enter the value
exists
Synax :
exists:table,column
Verify that the value is present in the data base
Filters
a data filter
Syntax :
$obj->functionName($data)
functions
string
num_int
number integer
num_float
number float
However, this function takes a second argument, which is the flag
Flags = e or E or , or .