PHPackages                             shamanhead/phpporser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. shamanhead/phpporser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

shamanhead/phpporser
====================

Advanced parser for advanced tasks

v0.3(5y ago)72563AGPL-3.0-or-laterPHPPHP &gt;=7.2

Since Jun 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ShamanHead/phpporser)[ Packagist](https://packagist.org/packages/shamanhead/phpporser)[ Docs](https://packagist.org/packages/shamanhead/php-logger)[ RSS](/packages/shamanhead-phpporser/feed)WikiDiscussions 0.3 Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Phporser
========

[](#phporser)

- **Getting Started**
    - Requirements
    - Installing via composer
    - Installing via archive
    - Installing chromium executable
- **Parsing your first page**
- **Search methods**
- **Working with text**
- **Contribute**
- **License**

Getting Started
---------------

[](#getting-started)

### Requirements

[](#requirements)

Requires PHP 7.1+. Also needs [Headless Chromium PHP](https://github.com/chrome-php/headless-chromium-php) and chromium executable, if you want to use this library with headless browsing support(includes by standart in packagist version).

### Installing via composer

[](#installing-via-composer)

`$ composer require shamanhead/phpporser`

### Installing via archive

[](#installing-via-archive)

You can install this library also from archive, by downloading it from github. There is no dependendies needed, besides [Headless Chromium PHP](https://github.com/chrome-php/headless-chromium-php), if you want to use this library with headless browsing feature. Installing chromium executable If you want to use this library with headless browser, first you need to download executable of this browser. This might works on Windows, MacOs and Linux.

#### Choose browser that you want to use

[](#choose-browser-that-you-want-to-use)

Headless chromium supports all chomium-based browsers, like Chrome, Opera, Chromium etc. #### Installing chromium executable

[](#installing-chromium-executable)

I can recommend to use chromium instead of chrome, because of my observation he works better than chrome. So, go on the [official chromium browser downloading page](https://download-chromium.appspot.com/) and download it.

After doing this step, unpack archive and move to necessary place.

Then, specify path in your script:

```
require_once "vendor/autoload.php";

use HeadlessChromium\Page;

use ShamanHead\PhpPorser\App\Dom as Dom;

$dom = new Dom();
$dom->setHref('file:///home/shamanhead/dev/porser/phpporser-master/test.html');
$dom->setBrowserPath('PATH_TO_CHROME');
```

If you done all right, parser would work. If you have any errors occuring during this step, you can go see here, is there solution to solve your problem. In other case, please, open new issue here or on [Headless Chromium PHP](https://github.com/chrome-php/headless-chromium-php) page.

Parsing your first page
-----------------------

[](#parsing-your-first-page)

Huh, half of work done. So now, let's try to parse simple page, like [Computer sciense on wikipedia](https://en.wikipedia.org/wiki/Computer_science). With the help of it, I will show all the capabilities of the parser. First of all, let's try to get 'Computer sciense' string on top of the page:

```
