1. Go to this page and download the library: Download matejch/html_helpers 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/ */
matejch / html_helpers example snippets
$service = new HtmlTagRemover($htmlString);
service->removeTags(['a','img']);
$service = new HtmlTagRemover($htmlString);
$service->removeTags(['a' => 'href[files]']);
/** remove 'a' tags where href attribute contains `files` substring and span elements contains class with `test` string */
$service->removeTags(['a' => 'href[files]','span' => 'class[test]']);
$service = new HtmlFileExtractor($htmlString);
/** return files as array of strings directly from href and src */
$service->getFiles(['img','a'])
/** return files as array of strings from class attributes of span elements */
$service->getFiles(['span' => 'class'])
$service->getFiles(['span' => 'class','img'=>'alt'])
/** return files as array of strings from class attributes of span elements,
* where class contains substring 'es' and from alt attribute of image tags
*/
$service->getFiles(['span' => 'class[es]','img'=>'alt'])
composer remove matejch/html_helpers
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.