PHP code example of owja / php-helper

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

    

owja / php-helper example snippets



$sampleData = [
    'some' => [
        'value' => 'example',
        'othervalue' => new class {
            public function getSomething() {
                return 'else';
            }
        }
    ]
];

$data = new \Owja\Helper\Data($sampleData);

// $example = 'example';
$example = $data->get('some.value');

// $somethingElse = 'else';
$somethingElse = $data->get('some.othervalue.something');

// $null = null
$null = $data->get('this.does.not.exist');



// $randomString = Random String with 128 alphanummeric Chars
$randomString = (string) new \Owja\Helper\Random(128);

// $randomString = Random String with 64 Numbers
$randomString = (string) new \Owja\Helper\Random(64, \Owja\Helper\Random::NUMBERS);

// Alternative
$rnd = new \Owja\Helper\Random();

$randomString64Chars = $rnd->generate(64);
$randomString64Numbers = $rnd->generate(64, \Owja\Helper\Random::NUMBERS);
$randomString256Hex = $rnd->generate(256, \Owja\Helper\Random::HEX);


$ composer