PHP code example of izica / phalcon-meta-tags

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

    

izica / phalcon-meta-tags example snippets


    setTitle($title)
    getTitle()
    setByProperty($property, $content)
    unsetByProperty($properties) //array or single property name

    setByName($name, $content)
    unsetByName($properties) //array or single name

    setCustom($key, $attributes) //unique key and attributes array
    unsetCustom($keys) //array or single value
    getMeta() // return metas string

    $di = new DI();
    $di->set('metatag', function() {
    	return new IzicaMetaTags();
    });

    <!DOCTYPE html>
    <html>
        <head>
             echo $this->metatag->getTitle();

    use Phalcon\Mvc\Controller;

    class IndexController extends Controller
    {
        public function indexAction()
        {
            $this->metatag->setTitle("Phalcon MetaTags Service");

            $this->metatag->setCustom("charset", ['charset' => 'UTF-8']);
            $this->metatag->setCustom("http", ['http-equiv' => 'content-type', 'content' => 'text/html; charset=UTF-8']);

            $this->metatag->setByName("description", "phalcon php metatags");

            $this->metatag->setByProperty("og:description", "When Great Minds Don’t Think Alike");
        }
    }