2017 © Pedro Peláez
 

library linklord

A micro library to extract link's information from an HTML string

image

piradoiv/linklord

A micro library to extract link's information from an HTML string

  • Tuesday, July 16, 2013
  • by piradoiv
  • Repository
  • 1 Watchers
  • 2 Stars
  • 52 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

LinkLord

Build Status, (*1)

PHP Micro library to extract links from an HTML string., (*2)

How to install

The easiest way to install the library is using Composer., (*3)

{
  "require": {
    "piradoiv/linklord": "1.*"
  }
}

Please notice the library requires at least PHP 5.3 in order to work (tested on 5.3.26 and 5.4.16), (*4)

How to use it

# Require Composer autoloader
require 'vendor/autoload.php';

$html = '<html><body><a href="http://www.example.com/">Example</a></body></html>';
$parser = new \PiradoIV\Html\LinkLord\Parser($html);
$links = $parser->getLinks();

foreach ($links as $node) {
  echo "{$node->anchorText}\n";
}

Other features

Follow/Nofollow, (*5)

LinkLord is able to know whether the links are followed or not., (*6)

$node->isNoFollow;

What about images?, (*7)

If the link has an image child, it will be detected., (*8)

$node->isImage;

Mentions, (*9)

Looking for mentions on the code?, LinkLord is able to recognise mentions on the text, this means if there is a 'www.example.com' on the text and is not linked, this will count as a mention., (*10)

$possibleMentions = array('www.example.com', 'www.anotherdomain.com');
$mentions = $parser->getMentions($possibleMentions);

Contact me

If you need more examples or help, please contact me on Twitter, @PiradoIV :), (*11)

Enjoy! :), (*12)

The Versions

16/07 2013

dev-master

9999999-dev

A micro library to extract link's information from an HTML string

  Sources   Download

MIT

The Requires

 

28/06 2013

dev-develop

dev-develop

A micro library to extract link's information from an HTML string

  Sources   Download

MIT

The Requires

 

25/06 2013

1.0.0

1.0.0.0

A micro library to extract link's information from an HTML string

  Sources   Download

MIT

The Requires