Download the PHP package tobento/service-sanitizer without Composer

On this page you can find all versions of the php package tobento/service-sanitizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package service-sanitizer

Sanitizer Service

The Sanitizer Service provides an easy way to sanitize user input.

Table of Contents

Getting started

Add the latest version of the sanitizer service running this command.

Requirements

Highlights

Simple Example

Here is a simple example of how to use the Sanitizer Service.

Documentation

Sanitizing

Single value

Easily sanitize a single value.

Multiple values

Sanitize multiple values.

Nested values

If the incoming values contains "nested" data, you may specify these attributes in your filters using "dot" syntax:

Using array for filters

Depending on the FiltersParsers implementation you may need to set the filters by an array as a parameter might need the parsing notation such as ":".

Strict sanitation

If strict sanitation is used, filters will be applied even if the data does not exist.

Sanitized data only

Sometimes it might be useful to get only the sanitized data:

Filtering

Default filters

The following filters are available out of the box:

Filter Parameters Description
cast:int:12 int, float, string, bool, array Casts a value into the given type. You might define a default value as the second parameter. This works only on strict sanitation though.
date:Y-m-d:d.m.Y Any DateTime formats Formats the date from given to the target format.
remove:foo:bar As many as you want Removes the parameters set from an array.
trim Trims a string.
digit Get only digit characters.
alphaStrict Get only alpha characters [a-zA-Z].
stripTags Strips any tags.
ucwords Uppercase the first character of each word in a string.
lcfirst Make a string's first character uppercase.
lowercase Make a string lowercase.
uppercase Make a string uppercase.
array ['cast:string', 'cast:int'] Filters each array data. You must use array syntax for filters. The second parameter is optional and would be the filters for the array keys.
filterIf:attribute:value Applies filters if an attribute exactly matches the value.

:warning: Some filters like stripTags return the original value if the type is not a string. So you might add the cast:string filter in addition.

Custom Default Filters

If you want to set your own default filters you can do it by the following way:

Adding filters

You can add your own filters by the following way. If the same filter key already exists it will overwrite the filter.

A note on FilterIf

The "filterIf" filter applies filters only if a value matches the given condition.

You can easily add more FilterIf conditions by extending FilterIf class:

Parsing filters

You may change the behaviour of parsing the filters for sanitizing.

Credits


All versions of service-sanitizer with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
tobento/service-collection Version ^1.0
tobento/service-dater Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tobento/service-sanitizer contains the following files

Loading the files please wait ....