Download the PHP package jijoel/sanitization-filters without Composer
On this page you can find all versions of the php package jijoel/sanitization-filters. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jijoel/sanitization-filters
More information about jijoel/sanitization-filters
Files in jijoel/sanitization-filters
Package sanitization-filters
Short Description Data sanitizer filters for use with waavi/sanitizer
License MIT
Informations about the package sanitization-filters
Sanitization Filters
This is a collection of custom sanitization filters to be used in conjunction with Waavi/Sanitizer.
Example
Given a data array with the following format:
We can easily format it using our Sanitizer and the some of Sanitizer's default filters:
Which will yield:
Available Filters
Filter | Description |
---|---|
alpha | Alphabetic characters only (a-z) |
address | Street Addresses |
country | Capitalize country name (or abbreviation) |
date | Date values |
limit | Trims the input at a given limit |
lower | Converts the given string to all lowercase |
money | Sets the given string to two decimal places |
name | Converts the string to a Proper Name (eg, Foo O'Bar) |
number | Returns the numeric part of the given string |
phone | A US Telephone number |
proper | Converts the given string to Proper (Title) Case |
state | Capitalize state name (or abbreviation) |
strip | Remove some problematic characters from input. These include: ' ? ; -- / & |
title-case | Converts the given string to Title Case |
upper | Converts the given string to all uppercase |
zip | Converts to a US zip code |
Installation
Install with composer:
composer require jijoel/sanitization-filters
We also include a Laravel service provider, via auto-discovery. For versions of Laravel prior to 5.5, add it to your providers array in config/app.php
:
Usage
It's recommended to sanitize your data in a FormRequest object before applying rules. The Waavi/Sanitizer package includes a SanitizesInput trait, which handles this automatically for you.
Please note that at this time, in order for this to work, the Sanitizer facade must exist.
All versions of sanitization-filters with dependencies
nesbot/carbon Version ~1.0|~2.0
waavi/sanitizer Version ^1.0.8