Skip to content

Commit

Permalink
Move Optional Laravel Usage to Laravel Usage Section
Browse files Browse the repository at this point in the history
  • Loading branch information
sharifzadesina committed Jul 11, 2021
1 parent 3884514 commit 293a050
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ class MyAwesomeRequest extends Request
}
```

#### Optional

If you are planning to use sanitizer for all your HTTP requests, you can optionally disable
Default Laravel `TrimStrings` and `ConvertEmptyStringsToNull` from your HTTP kernel.

```php
protected $middleware = [
[...]
// \App\Http\Middleware\TrimStrings::class,
// \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
[...]
];
```

Instead, you can use `trim` and `empty_string_to_null` filters.

```php
$filters = [
'some_string_param' => 'trim|empty_string_to_null',
];
```

## Available Filters

The following filters are available out of the box:
Expand Down Expand Up @@ -120,28 +142,6 @@ You can easily extend the Sanitizer library by adding your own custom filters, j
\Sanitizer::extend($filterName, $closureOrClassName);
```

#### Optional

If you are planning to use sanitizer for all your HTTP requests, you can optionally disable
Default Laravel `TrimStrings` and `ConvertEmptyStringsToNull` from your HTTP kernel.

```php
protected $middleware = [
[...]
// \App\Http\Middleware\TrimStrings::class,
// \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
[...]
];
```

Instead, you can use `trim` and `empty_string_to_null` filters.

```php
$filters = [
'some_string_param' => 'trim|empty_string_to_null',
];
```

## Inspiration

- [WAAVI Sanitizer](https://github.com/Waavi/Sanitizer)

0 comments on commit 293a050

Please sign in to comment.