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 3mo 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

29

—

LowBetter than 57% of packages

Maintenance45

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

432d ago

Major Versions

1.0.0 → 2.0.02025-04-04

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2567894?v=4)[Martin](/maintainers/martinille)[@martinille](https://github.com/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

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[civicrm/civicrm-core

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

751291.4k43](/packages/civicrm-civicrm-core)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[crwlr/crawler

Web crawling and scraping library.

36917.4k2](/packages/crwlr-crawler)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[oat-sa/tao-core

TAO core extension

66143.7k124](/packages/oat-sa-tao-core)

PHPackages © 2026

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