PHPackages                             aprillins/litegrabber - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. aprillins/litegrabber

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

aprillins/litegrabber
=====================

Grab content from a website using DOMXPath class in PHP

1.2(11y ago)080MITHTMLPHP &gt;=5.4.0

Since Apr 18Pushed 11y ago1 watchersCompare

[ Source](https://github.com/aprillins/LiteGrabber)[ Packagist](https://packagist.org/packages/aprillins/litegrabber)[ RSS](/packages/aprillins-litegrabber/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

LiteGrabber
===========

[](#litegrabber)

LiteGrabber is a simple website content scrapper that utilizing the default PHP DOMXPath class.

Installation
------------

[](#installation)

You can install LiteGrabber using [Composer](https://getcomposer.org/download/).

`composer require aprillins/litegrabber:dev-master`

Then, update your package.

`composer update`

Don't forget to execute `composer dumpautoload` after the installation.

Usage
-----

[](#usage)

Using LiteGrabber is tremendously easy. Scrapping can be done with three simple step. First, create the LiteGrabber instance.

```
$liteGrabber = new LiteGrabber($url);
```

Second, create the query for which element you want to scrap. For example, if you want to get a link from `a` tag inside `div` tag the query will be like this.

```
$query = $liteGrabber->div([], true)->a()->atSrc()->getQuery();
```

OR Since 1.2 you can build the query simpler than before. The way it works is like this.

```
$query = $liteGrabber->div()->a()->atSrc()->getQuery();
```

Third, let's get the result!

```
$liteGrabber->getResult();
```

The result will be returned in a form of array. The result will be an empty array if your query compositions don't match with the actual element on a web page you want to scrap.

Query Explanation
-----------------

[](#query-explanation)

On the second step above, you see that `div([], true)` have to parameters. The first one is specification of tag attribute. If you want to scrap specifically from `div` which has certain class attribute with certain value. You have to set the array.

```
div(['class' => 'post-wrapper home'], true)
```

Example above will set the query to ``. You MUST NOT forget to put second argument to `true` for the first query. Whoops don't worry since version 1.2 you MAY forget to put arguments for the first query. The default is set to empty array for first argument and true for second argument.

If you have done arranging the query, end it with `getQuery()` to make sure that you reach the end of query and ready to process to the next step.

The LiteGrabber is tested with PHPUnit.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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

Every ~5 days

Total

3

Last Release

4037d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/99e2d4252dc8590308bb1418722911775d8735aff66b487bbfe5a8d589d74ea9?d=identicon)[aprillins](/maintainers/aprillins)

---

Top Contributors

[![aprillins](https://avatars.githubusercontent.com/u/1317947?v=4)](https://github.com/aprillins "aprillins (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aprillins-litegrabber/health.svg)

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

PHPackages © 2026

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