PHP code example of reactificate / utils

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

    

reactificate / utils example snippets




use Reactificate\Utils\Console;
use Reactificate\Utils\Loop;

cho($count . PHP_EOL);
    $count++;
});

use Reactificate\Utils\Console;

Console::write(uniqid());
Console::info(uniqid());
Console::comment(uniqid());
Console::dump([uniqid()]);
Console::echo(uniqid());
Console::error(uniqid());
Console::question(uniqid());
Console::writeln(uniqid());

use Reactificate\Utils\Utils;
use Reactificate\Utils\Config;

Utils::setConfigDirectory(__DIR__ . '/config/');

$config = Config::load('server.php')

/**
 * Supposing config/server.php contains
 * return [
    'address' => [
        'host' => '0.0.0.0',
        'port' => '8001'
    ]
  ]; 
 */

var_dump($config->get('address.host'));
var_dump($config->get('address.port'));

// You can also get the values at once
[$host, $port] = $config->get(['address.host', 'address.port']);