Download the PHP package binary-cats/sanitizer without Composer

On this page you can find all versions of the php package binary-cats/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 sanitizer

Sanitizer

https://github.com/binary-cats/sanitizer/actions https://github.styleci.io/repos/316763653 https://scrutinizer-ci.com/g/binary-cats/sanitizer/ Build Status

Introduction

Sanitizer provides your Laravel application with an easy way to format user input, both through the provided filters or through custom ones that can easily be added to the Sanitizer library.

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:

It's usage is very similar to Laravel's Validator module, for those who are already familiar with it, although Laravel is not required to use this library.

Filters are applied in the same order they're defined in the $filters array. For each attribute, filters are separered by | and options are specified by suffixing a comma separated list of arguments (see format_date).

Available filters

The following filters are available out of the box:

Filter Description
trim Trims a string
escape Escapes HTML and special chars using php's filter_var
lowercase Converts the given string to all lowercase
uppercase Converts the given string to all uppercase
capitalize Capitalize a string
cast Casts a variable into the given type. Options are: integer, float, string, boolean, object, array and Laravel Collection.
format_date Always takes two arguments, the date's given format and the target format, following DateTime notation.
strip_tags Strip HTML and PHP tags using php's strip_tags
digit Get only digit characters from the string
filter_if Applies filters if an attribute exactly matches value

Adding custom filters

You can add your own filters by passing a custom filter array to the Sanitize constructor as the third parameter. For each filter name, either a closure or a full classpath to a Class implementing the BinaryCats\Sanitizer\Contracts\Filter interface must be provided.

Closures must always accept two parameters: $value and an $options array:

Install

To install, just run:

composer require binary-cats/sanitizer

And you're done! If you're using Laravel, your application will autoamtically register Service provider, as well as the Sanitizer Facade:

If you prefer to do that manually, you need to add the values to your config/app.php:

Laravel goodies

If you are using Laravel, you can use the Sanitizer through the Facade:

You can also easily extend the Sanitizer library by adding your own custom filters, just like you would the Validator library in Laravel, by calling extend from a ServiceProvider like so:

You may also Sanitize input in your own FormRequests by using the SanitizesInput trait, and adding a filters method that returns the filters that you want applied to the input.

To generate a Sanitized Request just execute the included Artisan command:

php artisan make:sanitized-request TestSanitizedRequest

The only difference with a Laravel FormRequest is that now you'll have an extra 'fields' method in which to enter the input filters you wish to apply, and that input will be sanitized before being validated.

License

Sanitizer is open-sourced software licensed under the MIT license

Thanks

Many than for the original WAAVI Sanitizer which is the source for this repo. Unfortunately it does not appear to be maintained anymore.


All versions of sanitizer with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^8.0|^9.0|^10.0|^11.0
illuminate/validation Version ^8.0|^9.0|^10.0|^11.0
nesbot/carbon Version ^3.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 binary-cats/sanitizer contains the following files

Loading the files please wait ....