An open API service indexing awesome lists of open source software.

https://github.com/linkorb/smartlink

Boost SEO performance by automatically adding SmartLinks to your HTML content
https://github.com/linkorb/smartlink

Last synced: about 1 month ago
JSON representation

Boost SEO performance by automatically adding SmartLinks to your HTML content

Awesome Lists containing this project

README

        

# SEO Smart Link

## Usage

```php

$input = <<Hello, my name is Octocat.

I like Github, you can find it on http://github.com


I also use google.com a lot, and http://baidu.com too.


Sometimes I use FB. fb test, here's an image:


Link to twitter: @github, and google plus: +github!


INPUT;
$process = new SmartLink();

$process->enableAutoLink();

$process->addAutoCorrection(
new AutoCorrection('FB', 'Facebook')
);

$process->addAutoCorrection(
new AutoCorrection('+github', '+GitHub')
);

$process->addKeywordLink(
new KeywordLink('Octocat', 'http://octodex.github.com')
)->addKeywordLink(
new KeywordLink('Github', 'http://github.com', true)
);

$process->addRegexLink(
new RegexLink('@([A-Za-z0-9]+)', 'http://twitter.com/{{1}}', true)
);

$process->addRegexLink(
new RegexLink('\+[A-Za-z0-9]+', 'http://plus.google.com/{{0}}/Posts', true)
);

echo $output = $process->process($input);

```