Download the PHP package broeser/sanitor without Composer

On this page you can find all versions of the php package broeser/sanitor. 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 sanitor

Sanitor

Sanitor is a thin wrapper around PHP's sanitization functions filter_var, filter_input and filter_has_var.

Build Status codecov.io License SemVer 2.0.0

Latest stable version: 1.1.1

Why?

Goals

Installation

Sanitor works with PHP 5.4, 5.5., 5.6 and 7.0.

The package can be installed via composer:

composer require broeser/sanitor

How to use

IMPORTANT: Sanitor does only sanitization – never try to use it as a validation filter. It will not work as expected.

Basic usage with filter(), filterGet(), filterPost(), filterRequest(), filterCookie() etc.

The constructor takes the filter as first argument and, optionally, flags as second argument. The FILTER_NULL_ON_FAILURE-flag, that is used internally is always set by default, so you don't have to set it.

List of important public methods of Sanitizer:

If something went wrong while trying to filter, a SanitizationException is thrown. If anything else fails (e.g. a parameter was given in a different format than expected, a normal \Exception is thrown.

Changing the filter or flag

While usefulness might be debateable, you can change the filter and flags of an existing Sanitizer with the setSanitizeFilter(), setSanitizeFlags() and addSanitizeFlag()-methods.

Sanitize objects with SanitizableInterface and SanitizableTrait or AbstractSanitizable

If you'd like to sanitize objects, just let their class implement SanitizableInterface and use the SanitizableTrait within them. You have to implement getRawValue() to return the "raw", unfiltered value of your object and getSanitizer() to return the Sanitizer-class that shall be used to filter this value:

In case you prefer extending an abstract class, you can use AbstractSanitizable. That class (partly) implements SanitizableInterface and uses SanitizableTrait. It already contains a getSanitizer()-method returning $this->sanitizer, make sure to set it somewhere or override the method.

Contributing?

Yes, please!

See CONTRIBUTING.md for details and/or open an issue with your questions.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Sanitor?

It is a pun on sanitization / sane / janitor. Probably not a good one, though.


All versions of sanitor with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.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 broeser/sanitor contains the following files

Loading the files please wait ....