PHPackages                             lukaswhite/php-meta-tags-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. lukaswhite/php-meta-tags-parser

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

lukaswhite/php-meta-tags-parser
===============================

A PHP package for parsing meta tags in HTML documents

0.0.1(4y ago)0549MITPHP

Since Dec 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/lukaswhite/php-meta-tags-parser)[ Packagist](https://packagist.org/packages/lukaswhite/php-meta-tags-parser)[ RSS](/packages/lukaswhite-php-meta-tags-parser/feed)WikiDiscussions master Synced today

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

PHP Meta Tags Parser
====================

[](#php-meta-tags-parser)

Extracts metadata (title, description, Open Graph etc) from the content of a web page.

Note that this library simply deals with raw HTML, rather than try to tie you down to one particular method for retrieving the content of an external URL. (I usually use Guzzle, but to make it a dependency might cause difficulties in terms of versioning.)

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

[](#installation)

```
composer require lukaswhite/php-meta-tags-parser
```

Usage
-----

[](#usage)

```
use Lukaswhite\MetaTagsParser\Parser;

$html = '...';

$parser = new Parser();
$result = $parser->parse($html);
```

### Using the result

[](#using-the-result)

The `parse()` method returns an object that encapsulates any page data it's extracted from the provided HTML.

```
$result->getTitle();
$result->getDescription();
$result->getKeywords();
$result->getUrl();
$result->getFacebookAppId();

$result->openGraph()->getSiteName();
$result->openGraph()->getType();
$result->openGraph()->getTitle();
$result->openGraph()->getDescription();
$result->openGraph()->getLocale();
$result->openGraph()->getImages(); // returns an array of URLs
$result->openGraph()->getLatitude();
$result->openGraph()->getLongitude();
$result->openGraph()->getAltitude();

$result->toArray(); // all of the extracted metadata
```

It will also extract RSS and/or Atom feeds; `getFeeds()` returns an array of instances of the `Feed` class:

```
$feed->getType(); // Feed::RSS or Feed::ATOM
$feed->isRSS();
$feed->isAtom();
$feed->getUri();
$feed->getTitle();
```

The `getFeeds()` method accepts an optional `$type` argument, to choose one or the other:

```
$result->getFeeds(Feed::RSS);
// or
$result->getFeeds(Feed::ATOM);
```

Cleansing the data
------------------

[](#cleansing-the-data)

The package ships with a very simple string cleanser; essentially it just decodes any HTML entities. You're free to provide your own cleanser; just implement the `CleansesStrings` interface, and provide an instance to the parser's constructor. It simply needs to provide a `run()` method, that accepts a string and returns the cleansed version.

Sanitizing the data
-------------------

[](#sanitizing-the-data)

The package ships with a very simple string sanitzer; under the hood it simply uses the `strip_tags()` function. If you wish to provide your own sanitizer, just implement the `SanitizesStrings` interface, and provide an instance to the parser's constructor. It simply needs to provide a `run()` method, that accepts a string and returns the sanitized version.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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

1672d ago

### Community

Maintainers

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

---

Top Contributors

[![lukaswhite](https://avatars.githubusercontent.com/u/999014?v=4)](https://github.com/lukaswhite "lukaswhite (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lukaswhite-php-meta-tags-parser/health.svg)

```
[![Health](https://phpackages.com/badges/lukaswhite-php-meta-tags-parser/health.svg)](https://phpackages.com/packages/lukaswhite-php-meta-tags-parser)
```

###  Alternatives

[wp-media/wp-rocket

Performance optimization plugin for WordPress

7531.3M3](/packages/wp-media-wp-rocket)[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19139.2M47](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9843.5k](/packages/sauladam-shipment-tracker)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

113.2k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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