balpom/web-link

Advanced interfaces for HTTP links and it's realisation.

Maintainers

👁 balpom

Package info

github.com/balpom/web-link

Homepage

pkg:composer/balpom/web-link

Statistics

Installs: 31

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.1 2024-05-28 15:26 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 2c3656c8f2479989cdcd3df9abba0de849b7da39

  • Mikhail (Balpom)

httpweburllinkurihttp2psr-13psr13weblink

This package is auto-updated.

Last update: 2026-06-24 11:03:36 UTC


README

WebLink component extends LinkInterface and EvolvableLinkInterface from PSR-13 Link definition interfaces

This WebLink component extends PSR-13 Link definition interfaces and added to it additional methods:

interface WebLinkInterface extends LinkInterface
{
 // Returns the HTML tag which contains the link.
 public function getTag(): string;
 
 // For paired tags returns the HTML content between link open and close tags.
 public function getContent(): string;
 
 // Returns the attribute value or null, if attribute not exist.
 public function getAttribute(string $attr): string|int|float|bool|array|null;
}
interface EvolvableWebLinkInterface extends EvolvableLinkInterface, WebLinkInterface
{
 // Returns an instance with the specified tag.
 public function withTag(string $tag): static;

 // Returns an instance with the specified content.
 public function withContent(string $content): static;
}

Trivial realisation of WebLink component based on Symfony WebLink component https://github.com/symfony/web-link/

use Symfony\Component\WebLink\Link;
class WebLink extends Link implements EvolvableWebLinkInterface
{
// ...
}

License

MIT License See LICENSE.MD