PHP code example of folded / request

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

    

folded / request example snippets


use function Folded\setRequestValidationTranslationFolderPath;

setRequestValidationTranslationFolderPath(__DIR__ . "/lang");

use function Folded\getRequestValue;

echo getRequestValue("name");

use function Folded\getRequestValue;
use function Folded\hasRequestValue;

if (hasRequestValue("name")) {
  echo getRequestValue("name");
} else {
  echo "Request does not have key name.";
}

use function Folded\getAllRequestValues;

$values = getAllRequestValues();

foreach ($values as $name => $value) {
  echo "Post value for $name is $value";
}

use function Folded\validateRequest;

validateRequest([
  "name" => "

use function Folded\validateRequest;
use function Folded\requestValidationSucceeded;

validateRequest([
  "name" => "

use function Folded\validateRequest;
use function Folded\requestValidationSucceeded;
use function Folded\getRequestValidationErrors;

validateRequest([
  "email" => "

use function Folded\setRequestValidationLang;
use function Folded\setRequestValidationTranslationFolderPath;

setRequestValidationTranslationFolderPath(__DIR__ . "/lang");
setRequestValidationLang("fr");

use function Folded\storeOldRequestValues;
use function Folded\getOldRequestValue;

// Session must be enabled to make it work
session_start();

// As soon as possible
storeOldRequestValues();

// Get the old form values, assuming you previously listened a POST request with an email key
echo getOldRequestValue("email");