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
- Host: GitHub
- URL: https://github.com/linkorb/smartlink
- Owner: linkorb
- Created: 2014-03-12T08:18:10.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-01-17T19:20:34.000Z (over 9 years ago)
- Last Synced: 2025-04-02T04:01:38.730Z (about 2 months ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 3
- Watchers: 13
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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);
```