PHP code example of maximantonisin / veles-hide-string
1. Go to this page and download the library: Download maximantonisin/veles-hide-string 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/ */
maximantonisin / veles-hide-string example snippets
use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\StringTypeInterface;
$result = VelesHide::hide('[email protected] ', [
StringTypeStringTypeInterface::OPTION_LENGTH => 4,
StringTypeInterface::OPTION_OFFSET => 2,
]);
var_dump($result);
//string(29) "ex****[email protected] "
use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\EmailTypeInterface;
$result = VelesHide::hide('[email protected] ', [
EmailTypeInterface::OPTION_LENGTH => 4,
EmailTypeInterface::OPTION_OFFSET => 2,
], 'email');
var_dump($result);
//string(29) "ex****[email protected] "
use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\EmailTypeInterface;
$result = VelesHide::hide('[email protected] ', [
EmailTypeEmailTypeInterface::OPTION_DOMAIN_LENGTH => 4,
EmailTypeInterface::OPTION_DOMAIN_OFFSET => 2,
], 'email');
var_dump($result);
//string(29) "e****leDomainName@ex****e.com"
use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\EmailTypeInterface;
$result = VelesHide::hide('[email protected] ', [
EmailTypeInterface::OPTION_LENGTH => 0,
EmailTypeInterface::OPTION_DOMAIN_LENGTH => 4,
EmailTypeInterface::OPTION_DOMAIN_OFFSET => 2,
], 'email');
var_dump($result);
//string(29) "exampleDomainName@ex****e.com"
use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\UrlTypeInterface;
$result = VelesHide::hide('https://foo.example.com/path/to/something?queryParam=queryValue', [
UrlTypeInterface::OPTION_LENGTH => 4,
UrlTypeInterface::OPTION_OFFSET => 2,
], 'url');
var_dump($result);
//string(23) "https://fo****ample.com"
use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\UrlTypeInterface;
$result = VelesHide::hide('https://foo.example.com/path/to/something?queryParam=queryValue', [
UrlTypeInterface::OPTION_LENGTH => 0,
UrlTypeInterface::OPTION_SCHEME_LENGTH => 2,
UrlTypeInterface::OPTION_SCHEME_OFFSET => 2,
], 'url');
var_dump($result);
//string(23) "ht**s://foo.example.com"
use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\UrlTypeInterface;
$result = VelesHide::hide('https://foo.example.com/path/to/something?queryParam=queryValue', [
UrlTypeInterface::OPTION_LENGTH => 0,
UrlTypeInterface::OPTION_PATH_LENGTH => 6,
UrlTypeInterface::OPTION_PATH_OFFSET => 2,
], 'url');
var_dump($result);
//string(41) "https://foo.example.com/p******/something"
use MaximAntonisin\Veles\VelesHide;
use MaximAntonisin\Veles\Type\UrlTypeInterface;
$result = VelesHide::hide('https://foo.example.com/path/to/something?queryParam=queryValue', [
UrlTypeInterface::OPTION_LENGTH => 0,
UrlTypeInterface::OPTION_PATH_LENGTH => 0,
UrlTypeInterface::OPTION_QUERY_LENGTH => 4,
UrlTypeInterface::OPTION_QUERY_OFFSET => 2,
], 'url');
var_dump($result);
//string(63) "https://foo.example.com/path/to/something?qu****aram=queryValue"