Author: Manuel Lemos
Updated on: 2023-10-20
Posted on: 2023-10-20
Package: PHP Sanitize Object
When the user enters the values, for instance, in a form, it may be necessary to tell the user to fix invalid values submitted via forms so that the values can comply with applicable rules.
For simple user mistakes, such as incorrect use of the case of words of a person's name, it may be more user-friendly to make the PHP code fix the issue of the letters rather than making the user select the case of the person's name.
This package can do that kind of automatic fixing of values passed to the PHP application by sanitizing important data object classes according to the rules defined in the comments of those classes.
This way, the user will not be bothered to fix the values entered in the forms, and those values will be compliant with the PHP application rules.
About the PHP Sanitize Object Package
The package PHP Sanitize Object is one of the few PHP packages that was considered notable recently because it does something worth paying attention to.
The basic purpose is: Process class variables with rules from comments
Here follows in more detail what it does:
This package can process class variables with rules from comments.
It can take an object of a given class and parses the class file to extract sanitization rules defined in the class code comments.
This package can process the class variables and change their values according to the sanitization rules.
Currently, it supports the following sanitization rules:
- Contain only ASCII characters
- Capitalize the letters of sentence strings
- Numbers above zero
- String only with integer characters
- Numbers below zero
- String with lowercase letters
- String with padding characters
- String without HTML tags
- Trimmed string
- Upper case letters
Conclusion
The PHP Sanitize Object can be downloaded from download page or be installed using the PHP Composer tool following instructions in the Composer install instructions page.
This package was considered notable for implementing its benefits in a way worth noticing.
Notable PHP packages can often be considered innovative. If this package is creative, it can be nominated for the PHP Innovation Award, and the author may win prizes and recognition for sharing innovative packages.
If you also developed notable or innovative packages, consider sharing them to earn more visibility for your package and excellent prizes.
One nice prize that many PHP developers want and you may like is the PHP elePHPant mascot plush.
You need to be a registered user or login to post a comment
Login Immediately with your account on:
Comments:
No comments were submitted yet.