PHP code example of lithiumdev / laravel-tagcloud
1. Go to this page and download the library: Download lithiumdev/laravel-tagcloud library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lithiumdev / laravel-tagcloud example snippets
'providers' => array(
// ...
LithiumDev\TagCloud\ServiceProvider::class,
),
use LithiumDev\TagCloud\TagCloud;
$cloud = new TagCloud();
$cloud->addTag("tag-cloud");
$cloud->addTag("programming");
echo $cloud->render();
// Assumes use of Facade "TagCloud"
$cloud = \TagCloud::addTags(['tag_1', 'tag_2', 'tag_3']);
echo $cloud->render();
$cloud->addString("This is a tag-cloud script!");
$cloud->addTags(array('laravel', 'laravel-tagcloud','php','github'));
$cloud->setRemoveTag('github');
$cloud->setRemoveTags(array('tag','cloud'));
$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));
$cloud->setMinLength(3);
$cloud->setLimit(10);
$cloud->setOrder('colour','DESC');
$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> ";
});
echo $cloud->render();
$tagCloud->setOption('transliterate', false);