{"id":20282031,"url":"https://github.com/matej-ch/html-helpers","last_synced_at":"2026-06-07T11:32:28.659Z","repository":{"id":62550952,"uuid":"463870376","full_name":"Matej-ch/html-helpers","owner":"Matej-ch","description":"Two simple classes for removing html tags and extracting file patchs from tags","archived":false,"fork":false,"pushed_at":"2022-06-17T13:12:06.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-14T07:34:45.133Z","etag":null,"topics":["dom-manipulation","domdocument","html","html-tags","parsing","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Matej-ch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-26T14:07:32.000Z","updated_at":"2022-08-02T17:45:08.000Z","dependencies_parsed_at":"2022-11-03T02:00:52.089Z","dependency_job_id":null,"html_url":"https://github.com/Matej-ch/html-helpers","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Matej-ch%2Fhtml-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Matej-ch%2Fhtml-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Matej-ch%2Fhtml-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Matej-ch%2Fhtml-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Matej-ch","download_url":"https://codeload.github.com/Matej-ch/html-helpers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241774462,"owners_count":20018277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dom-manipulation","domdocument","html","html-tags","parsing","php"],"created_at":"2024-11-14T14:07:55.147Z","updated_at":"2025-03-04T03:23:38.014Z","avatar_url":"https://github.com/Matej-ch.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![latest_tag](https://badgen.net/github/tag/Matej-ch/HtmlHelpers)\n\n### Two PHP helper classes for removing html tags and extracting file paths\n\n---\nInstall in your project\n```\ncomposer require matejch/html_helpers \"^1.0.0\"\n```\n---\n\n### class HtmlTagRemover\n\nWith class ``HtmlTagRemover`` you can remove specified html tags and its content from html string\n\n_Example: remove tags based on name_\n\n\n```php\n\n$service = new HtmlTagRemover($htmlString);\nservice-\u003eremoveTags(['a','img']);\n```\n---\n\n_Example: remove tags based on content of attribute_\n```php\n$service = new HtmlTagRemover($htmlString);\n\n$service-\u003eremoveTags(['a' =\u003e 'href[files]']);\n\n/** remove 'a' tags where href attribute contains `files` substring and span elements contains class with `test` string */\n$service-\u003eremoveTags(['a' =\u003e 'href[files]','span' =\u003e 'class[test]']);\n```\n\n---\n\n### class HtmlFileExtractor\n\nI created this class, because I needed to extract file paths from html before sending email, and add the as attachment\n\nThis class can return source from _img_ or _a_ tags automatically\n\nBut also from custom tags or attributes\n\n_Example: get file paths from **img** and **a** tag_\n```PHP\n$service = new HtmlFileExtractor($htmlString);\n\n/** return files as array of strings directly from href and src */\n$service-\u003egetFiles(['img','a'])\n```\n---\n_Example: get file paths other tags or specified attributes_\n```PHP\n/** return files as array of strings from class attributes of span elements */\n$service-\u003egetFiles(['span' =\u003e 'class'])\n\n$service-\u003egetFiles(['span' =\u003e 'class','img'=\u003e'alt'])\n\n/** return files as array of strings from class attributes of span elements, \n * where class contains substring 'es' and from alt attribute of image tags\n */\n$service-\u003egetFiles(['span' =\u003e 'class[es]','img'=\u003e'alt'])\n```\n---\nRemove package from your project\n```php \ncomposer remove matejch/html_helpers\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatej-ch%2Fhtml-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatej-ch%2Fhtml-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatej-ch%2Fhtml-helpers/lists"}