PHP code example of nadylib / type
1. Go to this page and download the library: Download nadylib/type 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/ */
nadylib / type example snippets
use Nadylib\Type;
$untrustedInput = $request->get('input');
// Turns a string-like value into a non-empty-string
$trustedInput = Type\nonEmptyString()->coerce($untrustedInput);
// Or assert that it's already a non-empty-string
$trustedInput = Type\nonEmptyString()->assert($untrustedInput);
// Or check if it's a non-empty-string
$isTrustworthy = Type\nonEmptyString()->matches($untrustedInput);