PHP code example of gulasz101 / gettype

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

    

gulasz101 / gettype example snippets


use function gulasz101\gettype;

$app->add(new SayHalloFromDBCommand(
    new PDO(
        match (gettype($dsn = getenv('CLI_DB_DSN'))) {
            Type::BOOLEAN => throw new RuntimeException('CLI_DB_DSN env is missing'),
            Type::STRING => $dsn,
            default => throw new RuntimeException('CLI_DB_DSN env is setup with wrong type'),
        }
    ))
);