PHP code example of nhpiash / php-input-filter

1. Go to this page and download the library: Download nhpiash/php-input-filter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nhpiash / php-input-filter example snippets




use Nhpiash\InputFilter\InputFilter;

$name     = InputFilter::getString($_POST['name']);
$age      = InputFilter::getInt($_POST['age']);
$email    = InputFilter::getEmail($_POST['email']);
$website  = InputFilter::getSanitizedURL($_POST['website']);
$agreed   = InputFilter::getBoolean($_POST['terms']);
$filtered = InputFilter::getFilteredArray($_POST, 'string');
bash
php-input-filter/
├── vendor/                  ← Composer autoloading
│   └── autoload.php
├── src/
│   └── InputFilter.php      ← Core Library
├── examples/
│   ├── form.php             ← Bootstrap Example Form
│   └── validate-form.php    ← Input Handling Example
├── README.md
├── documentation.txt
├── composer.json
└── composer.lock