lithiumdev/laravel-tagcloud
Composer 安装命令:
composer require lithiumdev/laravel-tagcloud
包简介
A Laravel package for generating tag clouds.
README 文档
README
Laravel 5+ Tag Cloud Generator
from Lithium Hosting
We're always open to pull requests, feel free to make this your own or help us make it better.
Copyright
(c) Lithium Hosting, llc
License
This library is licensed under the GNU GPL license; you can find a full copy of the license itself in the file /LICENSE
Requirements
- Laravel 5.2+
- php 5.5.9+
- Knowledge of Laravel and php
Description
A Laravel package that aids in generation of tag clouds
Installation
Install this package through Composer. To your composer.json file, add:
"lithiumdev/laravel-tagcloud": "~1.0"
Next, run the Composer update comand
$ composer update
Add the service provider to app/config/app.php, within the providers array.
'providers' => array( // ... LithiumDev\TagCloud\ServiceProvider::class, ),
Usage
use LithiumDev\TagCloud\TagCloud; $cloud = new TagCloud(); $cloud->addTag("tag-cloud"); $cloud->addTag("programming"); echo $cloud->render();
Or:
// Assumes use of Facade "TagCloud" $cloud = \TagCloud::addTags(['tag_1', 'tag_2', 'tag_3']); echo $cloud->render();
Convert a string
$cloud->addString("This is a tag-cloud script!");
Adding multiple tags
$cloud->addTags(array('laravel', 'laravel-tagcloud','php','github'));
Removing a tag
$cloud->setRemoveTag('github');
Removing multiple tags
$cloud->setRemoveTags(array('tag','cloud'));
More complex adding
$cloud->addTag(array('tag' => 'php', 'url' => 'http://www.php.net', 'colour' => 1)); $cloud->addTag(array('tag' => 'ajax', 'url' => 'http://www.php.net', 'colour' => 2)); $cloud->addTag(array('tag' => 'css', 'url' => 'http://www.php.net', 'colour' => 3));
Set the minimum length required
$cloud->setMinLength(3);
Limiting the output
$cloud->setLimit(10);
Set the order
$cloud->setOrder('colour','DESC');
Set a custom HTML output
$cloud->setHtmlizeTagFunction(function($tag, $size) use ($baseUrl) { $link = '<a href="'.$baseUrl.'/'.$tag['url'].'">'.$tag['tag'].'</a>'; return "<span class='tag size{$size} colour-{$tag['colour']}'>{$link}</span> "; });
Outputting the cloud (shown above)
echo $cloud->render();
Transliteration
By default, all accented characters will be converted into their non-accented equivalent, this is to circumvent duplicate similar tags in the same cloud, to disable this functionality and display the UTF-8 characters you can do the following:
$tagCloud->setOption('transliterate', false);
lithiumdev/laravel-tagcloud 适用场景与选型建议
lithiumdev/laravel-tagcloud 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24.83k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2016 年 05 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「tag cloud」 「laravel」 「tagcloud」 「laravel tag cloud」 「laravel tagcloud」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lithiumdev/laravel-tagcloud 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lithiumdev/laravel-tagcloud 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lithiumdev/laravel-tagcloud 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A SDK for working with B2 cloud storage.
Small library to access Microsoft Windows Azure Blob Storage with a Service or a StreamWrapper.
UCloud Resource (Cloud) Storage SDK for PHP
The flysystem adapter for yandex disk rest api.
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
非官方云小票机SDK,支持飞鹅云,芯烨云,易联云,快递100,映美云,中午云,佳博云,优声云,365智能云打印等
统计信息
- 总下载量: 24.83k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 23
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-05-04