PHP code example of beastbytes / yii2-microformats

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

    

beastbytes / yii2-microformats example snippets


echo Microformat::widget([
    'microformat' => 'h-card', // name of the microformat
    'model' => $user, // the model that provides the data
    'attributes' => [ / the attributes array specifies the microformat properties
        'p-name:profile.name', // get the user's name from the profile relation
        'p-email',
        'p-tel:phone.value',        
        [ // Additional markup that is not a microformat property
            'value' => 'Address',
            'template' => '<div class="h-card__title">{value}</div>' // with it's own template
        ],
        [
            'property' => 'p-adr',
            'microformat' => 'h-adr, // Markup the address with an embedded h-adr microformat
            'model' => $user->address, // we can specify a new model for embedded microformats; if not given the parent microformat model is used
            'template' => '<div {options}>{value}</div>', // a new template for h-adr
            'attributes' => [
                'p-street-address', // fetch data from $user->address->street_address
                'p-locality',
                'p-region',
                'p-postal-code',
                [
                    'property' => 'p-geo',
                    'microformat' => 'h-geo',
                    'template' => '<div><span>{label}</span><data {options} value="{rawValue}">{value}</data></div>',
                    'formatter' => [ // use the