PHP code example of biteit / utils

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

    

biteit / utils example snippets


$array = [
    'level-1' => [
        'value' => 1,
        'level-2' => [
            'value' => 2
        ]
    ]
];

$walker = \BiteIT\Utils\ArrayWalker::create($array);

var_dump([
    $walker->get('level-1/value'), // returns 1
    $walker->get('level-1/level-2) // returns ['value' => 2]
]);

\BiteIT\Utils\Timer::start('level-1');
// your code
\BiteIT\Utils\Timer::start('level-1-1');
// your code
\BiteIT\Utils\Timer::end('level-1-1');
\BiteIT\Utils\Timer::end('level-1');

// renders nested list
echo \BiteIT\Utils\Timer::getInstance()->renderList();

use BiteIT\Utils\WebLoader;

$wl = new WebLoader(WebLoader::TYPE_CSS, __DIR__.'/assets', 'http://localhost/Utils/tests/assets');
$wl->setCache(true);
$wl->setDestination(__DIR__.'/webtemp/', 'http://localhost/Utils/tests/webtemp');
$wl->addLocal('style.css');
$wl->addLocal('style-2.css');
$wl->addRemote('https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css');

echo $wl->render();

use BiteIT\Utils\WLCreator;

$wlc = new WLCreator(__DIR__.'/webtemp/', 'http://localhost/Utils/tests/webtemp', __DIR__.'/assets', 'http://localhost/Utils/tests/assets');
$wlc->setCache(true);

$wl = $wlc->getCssLoader();
$wl->addLocal('style.css');
$wl->addLocal('style-2.css');
$wl->addRemote('https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css');
echo $wl->render();