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

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

hypejunction/http-parser
========================

A tool for scraping URL resources (oEmbed, OpenGraph, Twitter cards, JSON-LD)

0.2.0(1mo ago)65.1k↑185%3[1 issues](https://github.com/hypeJunction/http-parser/issues)3GPL-2.0-onlyPHPPHP ^8.1CI passing

Since Feb 3Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/hypeJunction/http-parser)[ Packagist](https://packagist.org/packages/hypejunction/http-parser)[ Docs](https://github.com/hypeJunction/http-parser)[ RSS](/packages/hypejunction-http-parser/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (7)Dependencies (8)Versions (9)Used By (3)

HTTP Parser
===========

[](#http-parser)

[![CI](https://github.com/hypeJunction/http-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/hypeJunction/http-parser/actions/workflows/ci.yml)

Parses HTTP resources into serializable arrays of oEmbed-like metatags.

Features
--------

[](#features)

- Parses HTTP resources into oEmbed-like arrays of metatags
- Extracts OpenGraph, Twitter card, JSON-LD (schema.org), ``, `` and `` data
- Discovers and resolves oEmbed endpoints (JSON and XML)
- Handy for rendering URL cards / link previews

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

[](#requirements)

- PHP 8.1+
- Guzzle 7

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

[](#installation)

```
composer require hypejunction/http-parser
```

Usage
-----

[](#usage)

```
require __DIR__ . '/vendor/autoload.php';

$client = new \GuzzleHttp\Client([
	'headers' => [
		'User-Agent' => 'MyApp LinkPreview/1.0 (+https://myapp.example)',
	],
	'timeout' => 5,
	'connect_timeout' => 5,
]);

$parser = new \hypeJunction\Parser($client);

$data = $parser->parse('https://example.com/some/page');
```

### Options

[](#options)

```
$parser = new \hypeJunction\Parser($client, [
	// Maximum number of bytes read from a response body (default: 2 MB)
	'max_body_length' => 2097152,

	// URL schemes the parser is allowed to fetch (default: http, https)
	'allowed_schemes' => ['http', 'https'],

	// Allow requests to private/reserved IP ranges (default: false — see SECURITY.md)
	'allow_private_hosts' => false,

	// Maximum number of  tags verified with an HTTP request per document (default: 10)
	'max_image_checks' => 10,

	// Maximum number of discovered oEmbed endpoints fetched per document (default: 3)
	'max_oembed_fetches' => 3,

	// Maximum number of redirects to follow; each target is re-validated (default: 5)
	'max_redirects' => 5,

	// Extra Guzzle request options merged into every request
	'request_options' => [],
], $logger); // optional PSR-3 logger
```

Security
--------

[](#security)

Fetching user-supplied URLs is dangerous by nature. The parser blocks private/reserved networks, re-validates redirects, and caps response sizes by default, but you must still:

- **Escape everything you render.** All returned values are attacker-controlled strings. Only render the oEmbed `html` field for an explicit allowlist of trusted providers, ideally in a sandboxed iframe.
- **Keep TLS verification on.** Never pass `'verify' => false` to Guzzle.
- **Consider an egress proxy** or IP pinning at the HTTP-client layer if DNS rebinding is in your threat model.

See [SECURITY.md](SECURITY.md) for the full threat model.

Sample Output
-------------

[](#sample-output)

```
{
	"url": "https://soundcloud.com/phobosrecords/maksim-light-pulse",
	"canonical": "https://soundcloud.com/phobosrecords/maksim-light-pulse",
	"oembed_url": "https://soundcloud.com/oembed?url=https%3A%2F%2Fsoundcloud.com%2Fphobosrecords%2Fmaksim-light-pulse&format=json",
	"icons": [
		"https://a-v2.sndcdn.com/assets/images/sc-icons/favicon-2cadd14b.ico"
	],
	"metatags": {
		"og:site_name": "SoundCloud",
		"og:type": "soundcloud:sound",
		"og:url": "https://soundcloud.com/phobosrecords/maksim-light-pulse",
		"twitter:title": "PHS014: Maksim Dark & Light Breath - Finger Pulse (Original Mix)",
		"twitter:card": "audio"
	},
	"tags": ["record", "sounds", "share", "sound", "audio", "tracks", "music", "soundcloud"],
	"provider_name": "SoundCloud",
	"description": "Stream PHS014: Maksim Dark & Light Breath - Finger Pulse (Original Mix) by Phobos Records",
	"title": "PHS014: Maksim Dark & Light Breath - Finger Pulse (Original Mix) by Phobos Records",
	"thumbnails": [
		"https://i1.sndcdn.com/artworks-000145456354-01w756-t500x500.jpg"
	],
	"type": "rich",
	"version": "1",
	"width": "100%",
	"height": "400",
	"html": "",
	"author_name": "Phobos Records",
	"author_url": "https://soundcloud.com/phobosrecords",
	"provider_url": "http://soundcloud.com",
	"thumbnail_url": "http://i1.sndcdn.com/artworks-000145456354-01w756-t500x500.jpg"
}
```

Development
-----------

[](#development)

```
composer install
composer test      # PHPUnit
composer analyse   # PHPStan
```

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance89

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 97% 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 ~500 days

Recently: every ~842 days

Total

8

Last Release

38d ago

PHP version history (2 changes)4.2.3PHP &gt;=5.5

0.2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/5071b1cd852e094b3f564962a625e04c227adc73af30c5b46b243ab8f20154a7?d=identicon)[hypeJunction](/maintainers/hypeJunction)

---

Top Contributors

[![hypeJunction](https://avatars.githubusercontent.com/u/1202761?v=4)](https://github.com/hypeJunction "hypeJunction (32 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

JSON-LDlink previewcardscraperopen-graphoembedtwitter tags

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hypejunction-http-parser/health.svg)

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[google/auth

Google Auth Library for PHP

1.4k302.1M240](/packages/google-auth)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M777](/packages/sylius-sylius)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M674](/packages/shopware-core)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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