PHPackages                             martinille/meta-tag-extraction - 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. martinille/meta-tag-extraction

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

martinille/meta-tag-extraction
==============================

PHP library for fetching and parsing meta tags from web pages using a given URL or HTML source.

2.1.1(1y ago)012MITPHPPHP &gt;=8.1CI passing

Since Apr 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/martinille/meta-tag-extraction)[ Packagist](https://packagist.org/packages/martinille/meta-tag-extraction)[ RSS](/packages/martinille-meta-tag-extraction/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (5)Used By (0)

Meta Tag Extraction
===================

[](#meta-tag-extraction)

[![Tests](https://github.com/martinille/meta-tag-extraction/actions/workflows/tests.yml/badge.svg)](https://github.com/martinille/meta-tag-extraction/actions/workflows/tests.yml)[![Coverage Status](https://camo.githubusercontent.com/2731626cf6c3c80b5c2e339644a1be0f859ebf9c3a3ba2d02bbf9f6ddce63101/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d617274696e696c6c652f6d6574612d7461672d65787472616374696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/martinille/meta-tag-extraction?branch=master)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

*A light-weight library for extracting meta tags from URL or HTML content.*

It allows you to:

- get all **meta tags from URL or HTML content** (including `title`, `charset`, and `html[lang]` attribute),
- set custom cache provider for caching the results of web scraping (using PSR-16 `Psr\SimpleCache\CacheInterface`),
- set custom HTTP client for web scraping (using PSR-18 `Psr\Http\Client\ClientInterface`),

This library can be considered as an extended alternative for [get\_meta\_tags()](https://www.php.net/manual/en/function.get-meta-tags.php) function.

### Requirements

[](#requirements)

- PHP 8.1 or higher
- PHP DOM extension

### Installation

[](#installation)

```
composer require martinille/meta-tag-extraction
```

### Usage

[](#usage)

```
use MartinIlle\MetaTagExtraction\MetaTagExtraction;

$url = 'https://example.com';
$metaTagExtraction = new MetaTagExtraction();

$metaTags = $metaTagExtraction->extractFromUrl($url);

foreach ($metaTags as $tag) {
	echo $tag->getName() . ': ' . $tag->getValue() . PHP_EOL;
}
/* output:
charset: utf-8
content-type: text/html; charset=utf-8
viewport: width=device-width, initial-scale=1
title: Example Domain
*/
```

### Examples

[](#examples)

- Extracting meta tags from HTML string: [docs/MetaTagExtraction\_html\_example.php](docs/MetaTagExtraction_html_example.php)
- Extracting meta tags from a URL: [docs/MetaTagExtraction\_url\_example.php](docs/MetaTagExtraction_url_example.php)

More examples: [docs/index.md](docs/index.md)

### Testing

[](#testing)

Unit tests:

```
composer test
```

Unit tests with coverage:

```
composer test:coverage
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance49

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Every ~8 days

Total

4

Last Release

379d ago

Major Versions

1.0.0 → 2.0.02025-04-04

### Community

Maintainers

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

---

Top Contributors

[![martinille](https://avatars.githubusercontent.com/u/2567894?v=4)](https://github.com/martinille "martinille (25 commits)")

---

Tags

meta-tagsmeta-tags-extractionmetadatawebscrapingwebextractiontagmetascraper

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/martinille-meta-tag-extraction/health.svg)

```
[![Health](https://phpackages.com/badges/martinille-meta-tag-extraction/health.svg)](https://phpackages.com/packages/martinille-meta-tag-extraction)
```

###  Alternatives

[raiym/instagram-php-scraper

Instagram PHP Scraper. Get account information, photos and videos without any authorization

3.3k1.2M6](/packages/raiym-instagram-php-scraper)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[crwlr/crawler

Web crawling and scraping library.

37214.8k2](/packages/crwlr-crawler)[vdb/php-spider

A configurable and extensible PHP web spider

1.4k181.0k7](/packages/vdb-php-spider)[jakubkulhan/chrome-devtools-protocol

Chrome Devtools Protocol client for PHP

183967.6k3](/packages/jakubkulhan-chrome-devtools-protocol)[nelexa/google-play-scraper

Scrapes app data from Google Play store.

88487.4k](/packages/nelexa-google-play-scraper)

PHPackages © 2026

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