PHP code example of technicalguru / utils

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

    

technicalguru / utils example snippets


use TgLog\Log;
use TgLog\Success;

foreach (Log::get() AS $message) {
	switch ($message->getType()) {
	case 'success':
		echo '<div class="text-success">'.$message->getMessage().'</div>';
		break;
	case 'error':
		echo '<div class="text-danger">'.$message->getMessage().'</div>';
		break;
	}
}

// Finally, clean all messages
Log::clean();

user \TgUtils\Obfuscation;

/*** Just create everything and put it in your HTML page **/
$htmlSource = Obfuscation::obfuscateText('+49 555 0123456');
$emailLink  = Obfuscation::obfuscateEmail('[email protected]');

/*************************** OR ***************************/
// Use your own tag ID 
$id         = Obfuscation::generateObfuscationId();

// Use this ID to get the bot-resistent HTML source
$htmlSource = Obfuscation::getObfuscatedHtmlSpan($id);

// And get the javascript
$textJavascript   = Obfuscation::obfuscateText('+49 555 0123456', $id);
$emailJavascript  = Obfuscation::obfuscateEmail('[email protected]', $id);


$objects    = array('user'   => $myUser);
$snippets   = array('header' => new HeaderSnippet(), 'footer' => $new FooterSnippet());
$formatters = array('date'   => new DateFormatter());
$language   = 'en';
$processor = new Processor($objects, $snippets, $formatters, $language);