Skip to content

Commit

Permalink
added a ToC to the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
arondeparon committed Apr 30, 2020
1 parent c711118 commit 1d00cc9
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ Often, validating your request is not enough. The request sanitizer allows you t
manipulate your form data before passing it to the validator. You can start using it in a matter
of minutes and it is fully compatible with Laravel's `FormRequest` object.

## Table of Contents

* [How to use](#how-to-use)
* [Installing](#installing)
* [Usage](#usage)
* [Predefined Sanitizers](#predefined-sanitizers)
+ [FilterVars usage](#filtervars-usage)
* [Writing your own Sanitizer](#writing-your-own-sanitizer)
* [Testing](#testing)
* [Credits](#credits)
* [License](#license)

## How to use

Syntax is similar to the way `rules` are added to a [Form Request](https://laravel.com/docs/master/validation#form-request-validation).
Expand Down Expand Up @@ -54,19 +66,19 @@ property of your form request.
- Contributions are appreciated!

### FilterVars usage
The FilterVars sanitizer acts as a wrapper of the default php filter_vars function.
In order to use it in your request class you must specify at least the `filter` option.
`options` are optional. Both parameters can be either an `array` or `string` type:
The FilterVars sanitizer acts as a wrapper of the default PHP `filter_var` function.
It accepts the same (optional) parameters as the original function.
Both parameters can be either an `array` or `string` type:
```php
{
protected $sanitizers = {
protected $sanitizers = [
'last_name' => [
FilterVars::class => [
'filter' => FILTER_SANITIZE_STRING,
'options' => FILTER_FLAG_STRIP_BACKTICK
]
]
}
];
}
```
For more information on filter_vars please refer to https://www.php.net/manual/en/function.filter-var.php.
Expand Down

0 comments on commit 1d00cc9

Please sign in to comment.