balpom/href

Simple interface for HTTP links.

v2.1.0 2024-05-30 15:53 UTC

This package is auto-updated.

Last update: 2024-11-30 17:00:41 UTC


README

Very simple interface for HTTP links with link mapping.

Href object

Href object implements very simple HrefInterface, which has two methods: link() and mapping(). This may be very useful for some website parsing (like web.archive.org, anonymouse.org, etc.), which work as webproxy and modify original site links.

Simple sample for http://ipmy.ru/, which proxying by http://web.archive.org/: link() method returned http://ipmy.ru/ string, mapping() method, as variant, returned http://web.archive.org/web/20230329035950/http://ipmy.ru/ string.

HrefCollection object

HrefCollection object implements very simple HrefCollectionInterface, which has three methods: getAll(), getByLink(string $uri) and getByMapping(string $uri), and contains collection of unique Href objects.

getAll() method returns array, which contain Href objects. getByLink($uri) and getByMapping($uri) methods returns Href objects or false, if collection not consist Href object with requested $uri.

Requirements

  • PHP >= 8.1

Installation

Using composer (recommended)

composer require balpom/href

License

MIT License See LICENSE.MD