Wallogit.com
2017 © Pedro Peláez
PHP HTML Utilities
This librairy provides utilities function to ease HTML manipulation, (*1)
Install package with composer, (*3)
composer require hugsbrugs/php-html
In your PHP code, load librairy, (*4)
require_once __DIR__ . '/vendor/autoload.php'; use Hug\Html\Html as Html;
Test if a link is external from given domain, (*5)
$bool = Html::is_external_link($domain = 'maugey.fr', $link = 'http://maugey.fr/coucou.html');
Test if a link is from given domain, (*6)
$bool = Html::is_domain_link($domain = 'tata.maugey.fr', $link = 'http://maugey.fr/coucou.html');
Replace all relatives path in HTML (script, style, img) with absolute ones with given page URL, (*7)
$html = Html::replace_rel_to_abs_paths($html, $page_url = 'http://portail.free.fr/m/');
Build an absolute link from relative link and page URL, (*8)
$html = Html::rel_to_abs($rel = '/js/script.js', $base = 'http://portail.free.fr/m/');
Return array of backlinks from given HTML page and domain, (*9)
$html = Html::find_backlinks($html, $domain = 'www.free.fr');
Returns array of canonicals from string, (*10)
$array = Html::get_canonicals($canonical_content = 'index, follow, noindex, noarchive');
Replaces all links in HTML by https, (*11)
$html = Html::set_href_ssl($html);
Set UTF-8 Charset in HTML page with correct syntax depending on Doctype, (*12)
$html = Html::set_charset_utf_8($html);
Remove all external link from HTML with given domain, (*13)
$html = Html::remove_external_links($html, $domain = 'free.fr');
Remove all
$html = Html::remove_script_style($html);
Extract , (*15)
content from HTML page$body = Html::extract_body_content($html);
Check for tag, (*16)
$is_spa = Html::is_spa($html);
Get all links, (*17)
$links = Html::get_links($html);
Get all iframes, (*18)
$links = Html::get_iframes($html);
Get external links, (*19)
$external_links = Html::get_external_links($html);
Get internal links, (*20)
$internal_links = Html::get_internal_links($html);
Get images, (*21)
$images = Html::get_images($html);
Obfuscate email to be incorporated in HTML, (*22)
$email = Html::DJNikMail($str = 'tatayoyo@free.fr');
phpunit --bootstrap vendor/autoload.php tests
Hugo Maugey visit my website ;), (*23)