PHP code example of refkinscallv / fvss

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

    

refkinscallv / fvss example snippets




/**
 * Preparation
 */

// Import FVSS classes into the global namespace
use CG\FVSS\Fvss;

// Load composer autoloader
[
    [
        "value"   => "Jhon Doe",
        "label"   => "Name",
        "type"    => "alpha",
        "length"  => false,
        "space"   => true,
        "punct"   => false,
    ], [
        "value"   => "0888888888",
        "label"   => "Phone Number",
        "type"    => "num",
        "length"  => 10, // minimum length
        "space"   => false,
        "punct"   => false,
    ], [
        "value"   => "2000-02-09",
        "label"   => "Date of Birth",
        "type"    => "date",
        "length"  => false,
        "space"   => false,
        "punct"   => false,
    ], [
        "value"   => "[email protected]",
        "label"   => "Email",
        "type"    => "email",
        "length"  => false,
        "space"   => false,
        "punct"   => false,
    ], [
        "value"   => "https://www.facebook.com",
        "label"   => "Social Media URL",
        "type"    => "url",
        "length"  => false,
        "space"   => false,
        "punct"   => false,
    ]
];

// Validation process
$validate = $fvss->validate($req);

// Output of the validation process is a boolean: true or false
// If the output is false, then the $validate->message object variable will have the value of the error message
if ($validate->status) {
    echo "So far so good";
} else {
    echo $validate->message;
}