PHP code example of lemonade / component_meta

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

    

lemonade / component_meta example snippets


use Lemonade\Meta\MetaData;
use Lemonade\Meta\MetaFactory;

// 1. Prepare meta data
// Create a data object that contains all information for SEO and social networks.
$data = new MetaData(
    websiteName: "Lemonade Framework",
    title: "Knihovna pro meta tagy",
    description: "Elegantní a efektivní PHP knihovna pro generování HTML meta tagů. Ideální pro webové stránky a CMS.",
    keywords: "php, framework, seo, meta, tagy, web, vývoj, knihovna",
    author: "Honza Mudrák",
    robots: "index,follow",
    canonical: "https://lemonadeframework.cz/",
    image: "https://cdn.lemonadeframework.cz/framework/small/color.png",
    custom: [
        "google-site-verification" => "J-QyBfS-jXv18vF-k4B2SgM_mD3E0E2Y9VzV8F",
        "robots" => "index,follow",
        "seznam-wmt" => "1234567890abcdef",
        "og:type" => "website",
        "og:locale" => "cs_CZ",
        "fb:app_id" => "1234567890",
        "twitter:site" => "@lemonade_cz"
    ]
);

// 2. Create a factory instance for generating tags
// Pass in the prepared data.
$metaFactory = new MetaFactory($data);

// 3. Generate and output HTML code
// MetaFactory implements Stringable, so you can echo it directly
echo $metaFactory;