nia/sanitizing

Sanitizing component provides classes and interfaces to sanitize values.

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.0.0 2016-03-28 16:53 UTC

This package is not auto-updated.

Last update: 2022-03-11 07:11:56 UTC


README

Sanitizing component provides classes and interfaces to sanitize values.

Installation

Require this package with Composer.

	composer require nia/sanitizing

Tests

To run the unit test use the following command:

$ cd /path/to/nia/component/
$ phpunit --bootstrap=vendor/autoload.php tests/

Sanitizers

The component provides several sanitizers but you are able to write your own sanitizer by implementing the Nia\Sanitizing\SanitizerInterface interface for a more specific use case.

Sanitizer Description
Nia\Sanitizing\ClosureSanitizer Sanitizer using a closure.
Nia\Sanitizing\CompositeSanitizing Composite sanitizers are used to combine multiple sanitizers and use them as one.
Nia\Sanitizing\NonWhitespaceSanitizer Sanitizer to remove all whitespaces from the passed content.
Nia\Sanitizing\NullSanitizer Null sanitizer object implementation.
Nia\Sanitizing\TrimSanitizer Sanitizer to remove all leading and trailing whitespaces from the passed content.

How to use

The following sample shows you how to use the Nia\Sanitizing\NonWhitespaceSanitizer.

	$sanitzer = new NonWhitespaceSanitizer();
	echo $sanitzer->sanitize(" \t \r \n foo\n \tbar \n"); // foobar