the-3labs-team/laravel-keyword-linker
最新稳定版本:v1.1.1
Composer 安装命令:
composer require the-3labs-team/laravel-keyword-linker
包简介
A Laravel package to link keywords in your content
README 文档
README
This is a package that converts keywords into links.
Requirements
| Package Version | Requirement | Version |
|---|---|---|
| 1.x.x | Laravel | 10.x or 11.x |
| 1.x.x | Nova | 4.x |
| dev-beta-laravel-12 | Laravel | 12.x |
| dev-beta-laravel-12 | Nova | 5.x |
Installation
You can install the package via composer:
composer install the-3labs-team/keyword-linker
You can publish the config file with:
php artisan vendor:publish --tag=keyword-linker-config
This is the contents of the published config file:
return [ 'limit-auto-keywords' => 5, // limit auto keywords to be linked 'whitelist' => [ 'p', 'blockquote', ], 'query_tracking' => [ 'enabled' => false, 'query_string' => 'tracking=kwlinker', ], ];
Usage
use The3LabsTeam\KeywordLinker\Facades\KeywordLinker; $content = "This is a test content"; $keywords = [ 'test' => 'https://example.com/test', // Usage: 'keyword' => 'link' ]; echo KeywordLinker::parse($content, $keywords); # output: This is a <a href="http://example.com/test">test</a> content
Common usage
Use rel attribute to add nofollow to the link
$keywords = [ 'test' => [ 'link' => 'https://example.com/test', 'rel' => 'nofollow' ], // Usage: 'keyword' => ['link' => 'link', 'rel' => 'nofollow'] ];
Use target attribute to open the link in a new tab
$keywords = [ 'test' => [ 'link' => 'https://example.com/test', 'target' => '_blank' ], // Usage: 'keyword' => ['link' => 'link', 'target' => '_blank'] ];
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
Sponsor
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-01