Download the PHP package zegnat/linkextractor without Composer
On this page you can find all versions of the php package zegnat/linkextractor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zegnat/linkextractor
More information about zegnat/linkextractor
Files in zegnat/linkextractor
Package linkextractor
Short Description A package that tries to figure out what resources an HTML document links to.
License 0BSD
Informations about the package linkextractor
LinkExtractor
The LinkExtractor tries to figure out what resources an HTML document links to.
This tries to solve 2 questions:
- what constitutes a link between an HTML document and another resource, and
- how to supply them in a useful (resolved) format.
The class is able to get (and resolve) every URL from a pre-parsed DOM in accordance with where the HTML5 specification allows URLs to be defined. The HTML5 specification is followed after a GitHub discussion about what a link is, and further in person discussion at IWC Berlin 2017.
Using versions < 1.0
The current function prototypes are the same as those that will be in 1.0.0. This means you can write the method calls in your code right now and update to 1.0.0 without breaking any of your calls later.
If you rely on specific output or exceptions from these methods however, there might be breaking changes before version 1.0.0. Take a look at the roadmap to version 1.0.0 to get an idea of what is likely to still be changed.
Don’t wait for 1.0.0 with using this library if you need it! Instead, start using it and leave the ever-important feedback.
Install
Via Composer
Usage
On PHP 8.4 and newer you can instead pass a document parsed with the new
\Dom\HTMLDocument API and its standards-compliant HTML parser:
Supplying your own XPath
An optional third constructor argument takes an already created \DOMXPath
or \Dom\XPath instance for the same document. If none is given, one will be
created.
Supported PHP versions
This library requires PHP 7.0 or newer and is tested against PHP 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 and 8.5.
From PHP 8.4 onwards it accepts both \DOMNode and \Dom\Node.
Testing
Tests run on every supported PHP version in containers, orchestrated by Castor. Each PHP version and its dependencies live entirely in their container, so only Castor and a container runtime are needed on the host:
Both Podman and Docker work. Whichever of the two is on your PATH is used,
preferring Podman when both are installed because it needs no root. Pass
--runtime to any of the tasks to choose explicitly:
Some test fixtures under tests/files are copied verbatim from external
open-source projects under their respective licenses; see CREDITS.md
for their sources and the LICENSES directory (REUSE).
License
The BSD Zero Clause License (0BSD). Please see the LICENSE file for more information.
Files under vendored/ are copied from other projects and keep
their own licenses. Each one has a .license sidecar naming its copyright and
license, with the full text in REUSE).