PHPackages                             deepslam/content-parser - 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. deepslam/content-parser

ActiveLaravel-package[Parsing &amp; Serialization](/categories/parsing)

deepslam/content-parser
=======================

Simple content grabber which can detecting content on various web pages

v1.0.5(8y ago)3221[1 issues](https://github.com/deepslam/ContentParser/issues)GPL-3.0PHP

Since May 18Pushed 8y agoCompare

[ Source](https://github.com/deepslam/ContentParser)[ Packagist](https://packagist.org/packages/deepslam/content-parser)[ RSS](/packages/deepslam-content-parser/feed)WikiDiscussions master Synced 4d ago

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

Content Parser - Laravel 5 package for automatically detecting a content on custom web pages.
=============================================================================================

[](#content-parser---laravel-5-package-for-automatically-detecting-a-content-on-custom-web-pages)

With this package, you can easily detect main content on different web pages and grab the content from it. This package provides following features:

- Expandable architecture. You can easily add support for new APIs
- Code cleaning. The package can automatically clean CSS and style attributes. Thus you always will receive clean and good HTML content.

The package uses automatic algorithms for grabbing data from web pages. You'll receive the title and the content from needle web page.

Requirements
------------

[](#requirements)

The package requires follow solutions:

- Laravel 5.x
- PHP 7.x
- [Graby](https://github.com/j0k3r/graby)
- [Curl](https://github.com/ixudra/curl)

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

[](#installation)

You can install the package via Composer. Just run:

```
php composer require deepslam/content-parser
```

Further, you have to add service provider in your config/app.php:

```
...
Deepslam\ContentParser\ContentParserServiceProvider::class,
...
```

At next step you need to create alias in your config/app.php:

```
'ContentParser' => Deepslam\ContentParser\ContentParser::class,
```

After it you need to publish configs:

```
php artisan vendor:publish --provider="Deepslam\ContentParser\ContentParserServiceProvider"
```

Do not forget to run config:cache command:

```
php artisan config:cache
```

That's all!

Settings
--------

[](#settings)

There are two different parsers:

- Standalone parser - [graby](https://github.com/j0k3r/graby/) which uses by default.
- MarcuryContentParser which uses [Mercury API](https://mercury.postlight.com/web-parser/)

Thus you have 3 configs:

- /config/deepslam/parser.php - This is the common config for all parsers. Here you can configure such options as necessary of cleaning code, stripping tags, set allow tags list etc.
- /config/deepslam/mercury-tools.php - There is only one settings - API key for Mercury API service
- /config/deepslam/graby.php - This is the copy of original settings of [graby](https://github.com/j0k3r/graby/) parser. You can read about it on [developer's page](https://github.com/j0k3r/graby/).

Usage
-----

[](#usage)

You can easily use ContentParser:

```
$parser = ContentParser::create();
```

There will be ContentParser object created.

This configuration will use "Graby" parser. If you need to use another one, you can specify it as a parameter:

```
$parser = ContentParser::create('mercury');
```

As result, you will receive ContentParser object.

For parse data, you must use parse method which return true\\false result (true if data has been received, false if not)

```
$parser->parse($url)
```

For getting a result of parsing there is one method:

- **getResult** - Returns needle ParsingResult object

There are a few methods in this object:

- **setTitle** - Set new title
- **setContent** - Set new content
- **setImage** - Set main image for the content
- **setOriginal** - Save original response
- **getTitle** - The title of result
- **getContent** - The content of result. It can be already cleaned if you specify it in configs.
- **getImage** - Returns URL to the OG Image or empty string
- **getOriginal** - Just returns service\\script original response
- **isEmpty** - Is it empty object (without data) or not?
- **stripContent** - Manually strip content from tags
- **cleanContent** - Manually clean content from strange classes, ID's and style blocks in the parsed HTML

Extending
---------

[](#extending)

If you want to add a new parser you must create a new class and inherit it from \\Deepslam\\ContentParser\\ContentParser class. You must realise the only one method - parse which must return bool as result and changes internal result object.

After it, you must specific your new class in the /config/deepslam/parser.php parsers array.

To use you parser specify it when you call ContentParser as shows below:

```
$parser = ContentParser::create('');
```

Full example
------------

[](#full-example)

```
        $parser = ContentParser::create('');
        $parser->parse('');
        $result = $parser->getResult();
        ->name = $result->getTitle();
        ->description = $result->getContent();
```

Support
-------

[](#support)

If you find bug or have question\\suggestion you can send e-mail to me: \[\]

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

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 ~6 days

Total

6

Last Release

3252d ago

Major Versions

v0.9.1 → 1.02017-05-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/cff7b7ddfbc7d375956aa186ed20a2b3e2c42a51a618a7a1be6f303c6d70d61d?d=identicon)[deepslam](/maintainers/deepslam)

---

Top Contributors

[![deepslam](https://avatars.githubusercontent.com/u/1567904?v=4)](https://github.com/deepslam "deepslam (1 commits)")

### Embed Badge

![Health badge](/badges/deepslam-content-parser/health.svg)

```
[![Health](https://phpackages.com/badges/deepslam-content-parser/health.svg)](https://phpackages.com/packages/deepslam-content-parser)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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