PHP code example of bupy7 / php-input-filter

1. Go to this page and download the library: Download bupy7/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/ */

    

bupy7 / php-input-filter example snippets


// module/Application/src/Form/SignInForm.php

use Bupy7\InputFilter\FormAbstract;

class SignInForm extends FormAbstract
{
    /**
     * @var string|mixed
     */
    public $email;
    /**
     * @var string|mixed
     */
    public $password;

    protected function inputs(): array
    {
        return [
            [
                'name' => 'email',
                '

// module/Application/src/Action/AuthAction.php

use Application/Form/SignInForm;

$signInForm = new SignInForm();
if ($this->getRequest()->isPost()) {
    $signInForm->setValues($this->getRequest()->getPost());
    if ($signInForm->isValid()) {
        // authentication...
        // $auth->setLogin($signInForm->email)
        // $auth->setPassword($signInForm->password);
        // $result = $auth->authenticate();
        if ($result->isValid()) {
            // some actions
        }
    }
}

// to do something next

"bupy7/php-input-filter": "*"