PHP code example of mpaleo / view-tags

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

    

mpaleo / view-tags example snippets


    ...
    ViewTags\ViewTagsServiceProvider::class,
    ...
    

    ...
    'ViewTags' => ViewTags\ViewTags::class,
    ...
    

ViewTags::tag('viewOne', 'someTag');
ViewTags::tag('viewTwo', 'someTag');
ViewTags::tag('viewThree', ['someTag', 'anotherTag']);

ViewTags::taggedWith('someTag');
/* Output:
 * array(3) {
 *   [0] => "viewOne"
 *   [1] => "viewTwo"
 *   [2] => "viewThree"
 * }
 */
 
ViewTags::taggedWith('anotherTag');
/* Output:
 * array(1) {
 *   [0] => "viewThree"
 * }
 */