PHP code example of carry0987 / tag

1. Go to this page and download the library: Download carry0987/tag 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/ */

    

carry0987 / tag example snippets




use carry0987\Tag\Tag;

$tag = new Tag();

// Set and get string tags
$tag->setString('php,library,tag');
echo 'String Tags: ', $tag->getString(), PHP_EOL;

// Convert string tags to array
print_r($tag->getList());

// Classify tags and differentiate into groups
$tag->classifyTagGroup();
print_r($tag->getClassified());
print_r($tag->getUnclassified());

// Normalize a tag name for consistent formatting
echo Tag::clearTagName('  Normalize: This_Tag!  '), PHP_EOL;

// Merge and manipulate tag IDs
$tagsArray = [['id' => 1, 'name' => 'php'], ['id' => 2, 'name' => 'library']];
$mergedTagIds = Tag::mergeTagID($tagsArray, 'id');
echo 'Merged Tag IDs: ', $mergedTagIds, PHP_EOL;