PHP code example of tutu-ru / lib-host-alias-resolver
1. Go to this page and download the library: Download tutu-ru/lib-host-alias-resolver 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/ */
tutu-ru / lib-host-alias-resolver example snippets
/** @var \TutuRu\Config\ConfigInterface $configContainer */
$resolver = new HostAliasResolver($configContainer);
print $resolver->resolve('mainpage.desktop.rus/query?arg=1#hash');
print $resolver->getHostByAlias('services.partnerApi');
// rus.desktop.mainpage = main.host.com
print $resolver->resolve('mainpage.desktop.rus/query?arg=1#hash');
// выведет https://main.host.com/query?arg=1#hash
// https:// в ноде нет, resolve подставляет его сам
// external.partnerApi = https://somerestapi.com
print $resolver->getHostByAlias('partnerApi.external');
// выведет https://somerestapi.com