Hey there! Are you looking for PHP Sanitizers?

Puneet Gopinath's photo
Puneet Gopinath
·Mar 14, 2021·

2 min read

Subscribe to my newsletter and never miss my upcoming articles

Hooray! You got it!

Try this library in GitHub

What is Sanitize ??

/ˈsanɪtʌɪz/ - to make something completely clean and free from bacteria.

In web development to sanitize(or sanitizing in web) means that you remove unsafe characters from the input.

Sanitize is a function to check (and remove) harmful data (which can harm the software) from user input.
Sanitizing user input is the most secure method of user input validation to strip out anything that is not on the whitelist.

When and why should I use Sanitizers ?

Whenever you store user's data, and if that data will be read/available to (unsuspecting) users, then you have to sanitize it.
See HTML sanitization in wikipedia

How can I clean user input ?

  • First, Sanitize
  • Then, Validate
  • Last, Escape output. Validating process image


If you sanitize user input then, you will be able to manage data properly, validate it, show it in a secure and reliable way.

It makes your web application trustworthy, so it must be one of your main goals from the beginning of your career as a web developer.

Share this