pmvc-plugin/html_parser

0.1.11 2018-04-21 23:27 UTC

This package is auto-updated.

Last update: 2021-11-12 09:05:11 UTC


README

Latest Stable Version Latest Unstable Version Build Status License Total Downloads

Html Parser

How to use?

public function css($content, $selector)

include('vendor/autoload.php');
PMVC\Load::plug();
$plug = \PMVC\plug('html_parser');
$object = $plug->css($html, $your_css_$selector);
var_dump($object->html());

Useful tip

text or html

  • object->text()
  • object->html()

get tag attribute

  • object->attr('href')

Process a list (QueryPath)

   $DOMElement = QueryPath->get(int index)                  // start from zero
   \PMVC\plug('html_parser')->css($DOMElement, $selector);

Parse Engine

Install with Composer

1. Download composer

2. Install Use composer.json or use command-line directly

2.1 Install Use composer.json

  • vim composer.json
{
    "require": {
        "pmvc-plugin/html_parser": "dev-master"
    }
}
  • php composer.phar install

2.2 Or use composer command-line

  • php composer.phar require pmvc-plugin/html_parser

or

  • composer require pmvc-plugin/html_parser