Download the PHP package expresspaygh/exp-refine without Composer
On this page you can find all versions of the php package expresspaygh/exp-refine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download expresspaygh/exp-refine
More information about expresspaygh/exp-refine
Files in expresspaygh/exp-refine
Package exp-refine
Short Description A request filtering and sanitization package with custom validations
License MIT
Informations about the package exp-refine
Table of Contents
- [Expresspay Refines]
- [Basic Usage]
- [Custom field types]
- [Writing custom rules]
Expresspay Refine
A simple server-side request filter, sanitizer and validator
Basic Usage
`Expay\Refine\Filter` does most of the work. Most calls to the class will only use the methods `addField` and `check`.
A field is defined with its key in the request and a value indicating its type. When this value is a string, its used to lookup a stored list of rules to filter the request value with.
Custom field types
Custom field types can be added by specifying the rules to apply to them. This can be done with the following code:
A factory function can be used to avoid repeating definitions.
Writing custom rules
Custom rules can be written by sub-classing \Expay\Refine\Rules\Rule
and
implementing the apply method.
Writing validations
Validations can be written by adding the filter rule and validation rules.
Visit this github repository Rakit/Validation for more validation rule options you can use.
Writing Custom Validation Rules
Custom validation rules can be written by adding the filter rule, then add validation rules as first argument and key value pairs containing your custom validation rule names and their respective classes as a second argument to the filter rule.
Visit this github repository Rakit/Validation/Override/Rules for more custom validation rule options you can use.