PHP code example of cba85 / php-seo-tag

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

    

cba85 / php-seo-tag example snippets


use Seo\Tag as Seo;

$tags = []; // Your tags
$seoTag = new Seo($tags);
$seo = $seoTag->render();

echo $seo;

$siteTags = []; // General tags of your website
$pageTags = []; // Tags of your page
$seotag = new SeoTag($siteTags, $pageTags);
$seo = $seotag->render();

    $tags['site_title'] => "The title of the website";
    

    $tags['page_title'] => "The title of the page";
    

    $tags['description'] => "The description of the page";
    

    $tags['url'] => "https://www.example.com";
    

    $tags['date'] => "2017-11-05 18:00:00";
    

    $tags['date'] => [
        'published' => "2017-11-02 12:30:00",
        'modified' => "2017-11-03 15:01:00",
    ];
    

    $tags['author'] => "Clement";
    

    $tags['twitter'] => "@jack";
    

    $tags['facebook'] => [
        'admins' => "Mark",
        'publisher' => "Priscilla",
        'app_id' => "123456789",
    ];
    

    $tags['image'] => "/img/image.jpg";
    

    $tags['image'] => [
        'path' => "/img/image.jpg",
        'height' => "350",
        'width' => "250",
    ];
    

    $tags['social'] => [
            "https://twitter.com/user",
            "https://www.facebook.com/user",
            "https://www.linkedin.com/in/user",
            "https://github.com/user",
            "https://medium.com/@user",
        ];
    

    $tags['webmaster_verifications'] => [
            'google' => "123456789",
            'bing' => "123456789",
            'alexa' => "123456789",
            'yandex' => "123456789",
        ];
    

    $tags['lang'] => "fr_FR";
    

    $tags['type'] => "WebSite";
    

     $tags['generator'] => "My awesome framework";
    

    $tags['canonical_url'] => "https://www.example.com";
    

    $tabs['previous_page'] => "https://www.example.com/post/1";
    $tabs['next_page'] => "https://www.example.com/post/2";
    
bash
composer