PHP code example of texdc / guard

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

    

texdc / guard example snippets


namespace my\lib;

use function texdc\guard\verify;

function storeRating(int $rating) : void {
    verify($rating)->numericRange(1, 10, 'rating should be from 1 - 10');
    // ...
}

function speak(string $message, ?int $times = null) : void {
    verify($message)->notEmpty('message is