mmcnairy/htmlprocessor

Import HTML content and strip divs and attributes

v1.0.1 2016-12-28 17:51 UTC

This package is auto-updated.

Last update: 2024-04-14 17:46:14 UTC


README

What is this repository for?

  • Parse HTML, removing divs and attributes passed in as parameters
  • v1.0.0

How do I get set up?

Installation

Install via composer composer require mmcnairy/htmlprocessor

For examples how to use the package look in the examples folder

Dependencies

HtmlProcessor depends on the simple_html_dom and StripAttributes packages. I had trouble finding them so they are included in the package and added to the namespace. There is no need to downloaded them.

Architecture

This package is written using the program to an interface design pattern. Feel free to suggest other libraries to code against to provide the DOM parsing and attribute stripping. I retrofitted the interfaces to require single function already in use by the simple_html_dom and StripAttributes libraries. If there are better or easier libraries it should be very straight-forward to code up new classes to use those.

Examples

There are two examples to show how to use the library. The programmatic.php file shows how to use the library in the background without using a web page. The form.php and process.php show how to use a form to submit data to the API to take in HTML and parse it for specified divs and attributes using the form.

Documentation

API documentation, including the simple_html_dom and StripAttributes classes is included in docs/api directory, generated by phpDocumentor. Thanks guys!

[//]: # (### Contribution guidelines ###)

[//]: # ( Writing tests) [//]: # ( Code review) [//]: # ( Other guidelines)