Package Data | |
---|---|
Maintainer Username: | arogozin |
Maintainer Contact: | arogozin@nyu.edu (Aleksandr Rogozin) |
Package Create Date: | 2013-09-16 |
Package Last Update: | 2014-07-11 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:10:06 |
Package Statistics | |
---|---|
Total Downloads: | 1,934 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 9 |
Total Watchers: | 3 |
Total Forks: | 8 |
Total Open Issues: | 1 |
PHP Tag Cloud composer package Implementation of http://lotsofcode.github.io/tag-cloud/
$cloud = new TagCloud();
$cloud->addTag("tag-cloud");
$cloud->addTag("programming");
echo $cloud->render();
$cloud->addString("This is a tag-cloud script, written by Del Harvey. I wrote this tag-cloud class because I just love writing code.");
$cloud->addTags(array('tag-cloud','php','github'));
$cloud->setRemoveTag('github');
$cloud->setRemoveTags(array('del','harvey'));
$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) {
$link = '<a href="'.$tag['url'].'">'.$tag['tag'].'</a>';
return "<span class='tag size{$size} colour-{$tag['colour']}'>{$link}</span> ";
});
echo $cloud->render();
More usages on in a prettier format can be found here: http://lotsofcode.github.com/tag-cloud
To run the unit test suite:
cd tests
curl -s https://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/phpunit lotsofcode/TagCloud/TagCloud.php
Indentation style, size and encoding should be followed as per .editorconfig settings.