PHP Sanitizer.

Erland Muchasaj
2 min readFeb 27, 2023

--

My first package for PHP

On the new year’s eve, I set out to build some open source packages for PHP and Laravel community which is one of the best communities you can find. The packages would consist of libraries, utilities, helpers and packages and also some starters for medium and large-scale projects.

I have been working with PHP and related technologies for over a decade now, and more often than not, I find myself using the same peace of code in different projects.

Up until now, I used to create libraries which I would just transfer files from one project to another and reuse the library, but I wanted something more manageable and if I wanted to change something or fix issues, to easily fix it in one place.

Backstory

In my early days in programming, I often had to create search pages using vanilla PHP.
This means I needed to get user input, parse it, sanitize it, and prepare for the query.
Another thing to consider was special characters for different languages for example:

э => e
Ë => e
Ç => c

For this reason I build a PHP Sanitizer class to only do just that. Sanitize user input and prepare it for SQL search queries.

It is very simple to use. I will do a follow up with some examples of how to use it on your projects.

Was it helpful?

Let me know in the comment section below if you ever use it in any of your projects.

Feel free to Subscribe for more content like this 🔔, clap 👏🏻 , comment 💬 and share the article with anyone you’d like

And as it always has been, I appreciate your support and thanks for reading.

--

--