Recommend this page to a friend! |
![]() ![]() |
Info | ![]() |
![]() |
![]() ![]() |
Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2023-09-14 (4 months ago) ![]() | Not yet rated by the users | Total: 75 | All time: 10,120 This week: 108![]() |
Version | License | PHP version | Categories | |||
phpsanitization 1.0.0 | Custom (specified... | 7 | PHP 5, Text processing, Validation, P... |
Description | Author | |
This package can verify and clean values to ensure they are valid. |
|
<?php |
<p align="center">
<img align="center" src="https://d.top4top.io/p_1862a8k1e1.png" height="350px" />
</p>
    
Simple PHP Sanitization Class
This is a simple class that can verify and clean values to assure they are valid.
It can take a given string and remove or encode certain types of text values, so it can be displayed in Web pages lowering the risk of being used to perform security attacks.
The class can also sanitize arrays of data by processing the array values one by one.
$ composer require phpsanitization/phpsanitization
include_once 'vendor/autoload.php';
use PhpSanitization\PhpSanitization\Sanitization;
use PhpSanitization\PhpSanitization\Utils;
$sanitizer = new Sanitization(new Utils);
echo $sanitizer->useSanitize("<script>alert('xss');</script>");
echo $sanitizer->useEscape("SELECT * FROM `users` WHERE `username` = 'admin';");
echo $sanitizer->useTrim(" This is a text ");
echo $sanitizer->useHtmlEntities("<script>alert('This is js code');</script>");
echo $sanitizer->useFilterVar("This is a string");
echo $sanitizer->useStripTags("<script>alert('This is js code');</script>");
echo $sanitizer->useStripSlashes("C:\Users\Faris\Music");
echo $sanitizer->useHtmlSpecialChars("<script>alert('This is js code');</script>");
$sanitizer->setData("This is data");
echo $sanitizer->getData();
echo $sanitizer->useStrReplace("text", "", "this is a text");
echo $sanitizer->usePregReplace("/([A-Z])\w+/", "This is a Text");
echo $sanitizer->validateEmail("fake.email@gmail.com") ? "true" : "false";
echo $sanitizer->isValid("127.0.0.1", FILTER_VALIDATE_IP) ? "true" : "false";
echo $sanitizer->isEmpty($variable) ? "true" : "false";
echo $sanitizer->isAssociative($array) ? "true" : "fale";
echo $sanitizer->callback(function () {
return "text";
});
The documentation for PhpSanitization is available here
Please have a look at CHANGELOG.md
.
Please have a look at CONTRIBUTING.md
.
Please have a look at CODE_OF_CONDUCT.md
.
This package is licensed using the MIT License.
Please have a look at LICENSE.md
.
Copyright (c) FarisCode - 2021
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.