PHP Sanitization Functions: Verify and clean values to assure they are valid

Recommend this page to a friend!
  Info   View files Documentation   View files View files (45)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2021-02-16 (2 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 116 All time: 9,299 This week: 285Up
Version License PHP version Categories
phpsanitization 1.0.6MIT/X Consortium ...5PHP 5, Security
Description Author

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.

Picture of Faris AL-Otaibi
  Performance   Level  
Name: Faris AL-Otaibi <contact>
Classes: 1 package by
Country: Saudi Arabia Saudi Arabia
Age: 24
All time rank: 427118 in Saudi Arabia Saudi Arabia
Week rank: 680 Up4 in Saudi Arabia Saudi Arabia Up

 

Details

<p align="center">

<img align="center" src="https://d.top4top.io/p_1862a8k1e1.png" height="350px" />

</p>

PhpSanitization

1 2 3 4 5 6 7 8

About

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.

Features

  1. Out-Of-The-Box
  2. Support String, Arrays, and Associative Arrays
  3. Escape PDO and SQL queries
  4. Easy to Use

Requirements

  1. PHP 7.0+
  2. Composer

How to install

$ composer require phpsanitization/phpsanitization

Usage

Class Inclusion

include_once 'vendor/autoload.php';

use PhpSanitization\PhpSanitization\Sanitization;

$sanitizer = new Sanitization();

useSanitize

echo $sanitizer->useSanitize("<script>alert('xss');</script>");

useEscape

echo $sanitizer->useEscape("SELECT * FROM `users` WHERE `username` = 'admin';");

useTrim

echo $sanitizer->useTrim(" This is a text ");

useHtmlEntities

echo $sanitizer->useHtmlEntities("<script>alert('This is js code');</script>");

useFilterVar

echo $sanitizer->useFilterVar("This is a string");

useStripTags

echo $sanitizer->useStripTags("<script>alert('This is js code');</script>");

useStripSlashes

echo $sanitizer->useStripSlashes("C:\Users\Faris\Music");

useHtmlSpecialChars

echo $sanitizer->useHtmlSpecialChars("<script>alert('This is js code');</script>");

setData

$sanitizer->setData("This is data");

getData

echo $sanitizer->getData();

Screenshot

Screenshot

Documentation

The documentation for PhpSanitization is available here

Changelog

Please have a look at CHANGELOG.md.

Contributing

Please have a look at CONTRIBUTING.md.

Code of Conduct

Please have a look at CODE_OF_CONDUCT.md.

License

This package is licensed using the MIT License.

Please have a look at LICENSE.md.

FOSSA Status

Copyright

Open Source Love

Copyright (c) FarisCode - 2021

  Files folder image Files  
File Role Description
Files folder image.github (4 files, 3 directories)
Files folder image.phive (2 files)
Files folder imageexamples (13 files)
Files folder imagesrc (1 file)
Files folder imagetest (1 file)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .phpcs.xml Data Auxiliary data
Accessible without login Plain text file .yamllint.yaml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file codecov.yml Data Auxiliary data
Accessible without login Plain text file composer-require-checker.json Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file infection.json Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file Makefile Data Auxiliary data
Accessible without login Plain text file phpstan-baseline.neon Data Auxiliary data
Accessible without login Plain text file phpstan.neon Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file psalm-baseline.xml Data Auxiliary data
Accessible without login Plain text file psalm.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
Files folder imageactions (1 directory)
Files folder imageISSUE_TEMPLATE (3 files)
Files folder imageworkflows (1 file)
  Accessible without login Plain text file CODE_OF_CONDUCT.md Data Auxiliary data
  Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
  Accessible without login Plain text file dependabot.yml Data Auxiliary data
  Accessible without login Plain text file SECURITY.md Data Auxiliary data

  Files folder image Files  /  .github  /  actions  
File Role Description
Files folder imagecomposer (1 directory)

  Files folder image Files  /  .github  /  actions  /  composer  
File Role Description
Files folder imagecomposer (2 directories)

  Files folder image Files  /  .github  /  actions  /  composer  /  composer  
File Role Description
Files folder imagedetermine-cache-directory (1 file)
Files folder imageinstall (2 files)

  Files folder image Files  /  .github  /  actions  /  composer  /  composer  /  determine-cache-directory  
File Role Description
  Accessible without login Plain text file action.yaml Data Auxiliary data

  Files folder image Files  /  .github  /  actions  /  composer  /  composer  /  install  
File Role Description
  Accessible without login Plain text file action.yaml Data Auxiliary data
  Accessible without login Plain text file run.sh Data Auxiliary data

  Files folder image Files  /  .github  /  ISSUE_TEMPLATE  
File Role Description
  Accessible without login Plain text file bug_report.md Data Auxiliary data
  Accessible without login Plain text file custom.md Data Auxiliary data
  Accessible without login Plain text file feature_request.md Data Auxiliary data

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file php_ci.yml Data Auxiliary data

  Files folder image Files  /  .phive  
File Role Description
  Accessible without login Plain text file composer-require-checker Data Auxiliary data
  Accessible without login Plain text file phars.xml Data Auxiliary data

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file data_getter_example.php Example Example script
  Accessible without login Plain text file data_setter_example.php Example Example script
  Accessible without login Plain text file escape_sql_query_example.php Example Example script
  Accessible without login Plain text file index.php Example Example script
  Accessible without login Plain text file sanitize_array_example.php Example Example script
  Accessible without login Plain text file sanitize_associative_array_example.php Example Example script
  Accessible without login Plain text file sanitize_string_example.php Example Example script
  Accessible without login Plain text file use_filter_var_example.php Example Example script
  Accessible without login Plain text file use_html_entities_example.php Example Example script
  Accessible without login Plain text file use_html_special_chars_example.php Example Example script
  Accessible without login Plain text file use_strip_slashes_example.php Example Example script
  Accessible without login Plain text file use_strip_tags_example.php Example Example script
  Accessible without login Plain text file use_trim_example.php Example Example script

  Files folder image Files  /  src  
File Role Description
  Plain text file Sanitization.php Class Class source

  Files folder image Files  /  test  
File Role Description
  Plain text file SanitizationTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:116
This week:0
All time:9,299
This week:285Up

For more information send a message to info at phpclasses dot org.