PHPackages                             mitseo/scraper - 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. mitseo/scraper

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

mitseo/scraper
==============

Parse document with xpath,css selector and regex.

v1.0(7y ago)41651MITPHP

Since Feb 25Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Mitsu66/Scraper)[ Packagist](https://packagist.org/packages/mitseo/scraper)[ RSS](/packages/mitseo-scraper/feed)WikiDiscussions master Synced 2d ago

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

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![Twitter URL](https://camo.githubusercontent.com/65b8a86722309182d910f4b8cd9b3fd530c8c6e24496d8975edc4e6ea95909b3/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f68747470732f747769747465722e636f6d2f666f6c645f6c6566742e7376673f7374796c653d736f6369616c266c6162656c3d466f6c6c6f772532302534304d697473756672)](https://twitter.com/Mitsufr)

This library helps you to parse data with different resources :

- Regex
- Xpath
- CSS Selector

Differents outputs are possibles :

- Match (match():boolean)
- Count elements (count():int)
- Extract first element (extractFirst():string)
- Extract all elements (extractAll():array)

**Author :** [Mitsu](https://twitter.com/Mitsufr)

Installation with composer :
----------------------------

[](#installation-with-composer-)

Add mitseo/scraper as a require dependency in your **composer.json** file:

```
composer require mitseo/scraper

```

Usage
-----

[](#usage)

### Parse with Regex

[](#parse-with-regex)

```
use Mitseo\Scraper\Scraper;

$string = "11111 222 33333 44444";

$regex1 = Scraper::regex("/[0-9]{5}/")->match($string);
$regex2 = Scraper::regex("/([0-9]{5})/")->extractFirst($string);
$regex3 = Scraper::regex("/([0-9]{5})/")->extractAll($string);
$regex4 = Scraper::regex("/[0-9]{5}/")->count($string);
```

### Parse with Xpath

[](#parse-with-xpath)

```
use Mitseo\Scraper\Scraper;

$dom = file_get_contents('https://en.wikipedia.com/');

$xpath1 = Scraper::xpath("//a")->match($dom);
$xpath2 = Scraper::xpath("//a")->extractFirst($dom);
$xpath3 = Scraper::xpath("//a")->extractAll($dom);
$xpath3 = Scraper::xpath("//a")->count($dom);
$xpath4 = Scraper::xpath("//a",["anchor"=>".","href"=>"@href"])->extractTree($dom);
```

### Parse with CSS Selector

[](#parse-with-css-selector)

```
use Mitseo\Scraper\Scraper;

$dom = file_get_contents('https://en.wikipedia.com/');

$css1 = Scraper::css("h1#truc")->match($dom);
$css2 = Scraper::css("h1")->extractFirst($dom);
$css3 = Scraper::css("a")->extractAll($dom);
$css4 = Scraper::css("a")->count($dom);
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2682d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/34723271?v=4)[Mitseo](/maintainers/Mitseo)[@Mitseo](https://github.com/Mitseo)

---

Top Contributors

[![mehdicolinfr](https://avatars.githubusercontent.com/u/158833827?v=4)](https://github.com/mehdicolinfr "mehdicolinfr (23 commits)")

---

Tags

css-selectorparserregexscrapingxpath

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mitseo-scraper/health.svg)

```
[![Health](https://phpackages.com/badges/mitseo-scraper/health.svg)](https://phpackages.com/packages/mitseo-scraper)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[voku/simple_html_dom

Simple HTML DOM package.

9038.8M80](/packages/voku-simple-html-dom)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[scotteh/php-dom-wrapper

Simple DOM wrapper to select nodes using either CSS or XPath expressions and manipulate results quickly and easily.

1482.0M11](/packages/scotteh-php-dom-wrapper)[spekulatius/phpscraper

PHPScraper, built with simplicity in mind. See tests/ for more examples.

587150.7k3](/packages/spekulatius-phpscraper)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2022.0M322](/packages/drupal-core-dev)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
