PHP code example of wepesi / metadata

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

    

wepesi / metadata example snippets


    use Wepesi\MetaData;
    $meta = MetaData::build();

  use Wepesi\MetaData;
  MetaData::build()->toArray();
  /**
      array(0) {
      }
    **/


    use Wepesi\MetaData;
    $meta= MetaData::build()
            ->title("Welcome To our Article")
            ->description("About Description of the article")
            ->lang("sw")
            ->type("article")
            ->link("https://www.domaine.com/about")
            ->cover("https://www.domaine.com/article-cover/cover.jpg")
            ->index()
            ->follow()
            ->toHtml();

    use Wepesi\MetaData;
    $structure= MetaData::build()->title("Welcome To Wepesi")->toArray();
    /**
    array(1) {
        ["title"]=>"Welcome To Wepesi"
    }
    */

    use Wepesi\MetaData;
    $structure= MetaData::build()
                ->title("Welcome To Wepesi")
                ->lang("fr")
                ->toArray();
    /**
    array(1) {
      ["title"]=>"Welcome To Wepesi"
      ["lang"]=>"fr"
    }
    */

    use Wepesi\MetaData;
    $structure= MetaData::build()
                ->title("Welcome To Wepesi")
                ->lang("en")
                ->cover("https://www.domaine.com/cover.jpg")
                ->toArray();
    //array(1) {
    //  ["title"]=>"Welcome To Wepesi"
    //  ["lang"]=>"en"
    //  ["cover"]=>"https://www.domaine.com/cover.jpg"
    // }

    use Wepesi\MetaData;
    $structure= MetaData::build()
                ->title("Welcome To Wepesi")
                ->author("Wepesi.")
                ->toArray();
    //array(1) {
    //  ["title"]=>"Welcome To Wepesi"
    //  ["author"]=>"Wepesi"
    // }

    use Wepesi\MetaData;
    $structure= MetaData::build()
                ->title("Welcome To Wepesi")
                ->description("Search engines typically show the meta description in search results below your title tag.")
                ->lang("fr")
                ->cover("https://www.domaine.com/cover.jpg")
                ->toArray();
    //array(1) {
    //  ["title"]=>"Welcome To Wepesi",
    //  ["description"]=>"Search engines typically show the meta description in search results below your title tag.",
    //  ["lang"]=>"fr",
    //  ["cover"]=>"https://www.domaine.com/cover.jpg",
    // }

    use Wepesi\MetaData;
    $structure= MetaData::build()
                ->title("Welcome To Wepesi")
                ->description("Search engines typically show the meta description in search results below your title tag.")
                ->lang("sw")
                ->type("article")
                ->toArray();
    //array(1) {
    //  ["title"]=>"Welcome To Wepesi",
    //  ["description"]=>"Search engines typically show the meta description in search results below your title tag.",
    //  ["lang"]=>"sw",
    //  ["type"]=>"article",
    // }

    use Wepesi\MetaData;
    $structure= MetaData::build()
                ->title("Welcome To our Article")
                ->description("Description of the article")
                ->lang("sw")
                ->type("article")
                ->link("https://www.domaine.com/article/welcom-to-wepesi")
                ->cover("https://www.domaine.com/article-cover/cover.jpg")
                ->toArray();
    //array(1) {
    //  ["title"]=>"Welcome To our Article",
    //  ["description"]=>"Description of the article",
    //  ["lang"]=>"sw",
    //  ["type"]=>"article",
    //  ["link"]=>"https://www.domaine.com/article/welcom-to-wepesi",
    //  ["cover"]=>"https://www.domaine.com/article-cover/cover.jpg",
    // }

    use Wepesi\MetaData;
    $structure= MetaData::build()
                ->title("Welcome To our Article")
                ->description("About Description of the article")
                ->lang("sw")
                ->type("article")
                ->link("https://www.domaine.com/about")
                ->cover("https://www.domaine.com/article-cover/cover.jpg")
                ->index()
                ->follow()
                ->toArray();
    //array(1) {
    //  ["title"]=>"Welcome To our Article",
    //  ["description"]=>"About Description of the article",
    //  ["lang"]=>"sw",
    //  ["type"]=>"article",
    //  ["link"]=>"https://www.domaine.com/article/welcom-to-wepesi",
    //  ["cover"]=>"https://www.domaine.com/article-cover/cover.jpg",
    //  ["tags"]=>["index","follow"],
    // }

    use Wepesi\MetaData;
    $structure= MetaData::build()
                ->title("Welcome To our Article")
                ->description("About Description of the article")                
                ->noindex()
                ->nofollow()
                ->toArray();
    //array(1) {
    //  ["title"]=>"Welcome To our Article",
    //  ["description"]=>"About Description of the article",
    //  ["tags"]=>["noindex","nofollow"],
    // }

    use Wepesi\MetaData;
    $structure= MetaData::build()
                ->title("Welcome To our Article")
                ->description("About Description of the article")                
                ->keywords(["HTML","CSS","JavaScript"])
                ->toArray();
    //array(1) {
    //  ["title"]=>"Welcome To our Article",

    //  ["description"]=>"About Description of the article",
    //  ["keywords"]=>["HTML","CSS","JavaScript"]
    // }

    use Wepesi\MetaData;
    $structure = MetaData::build()
                ->title("Welcome To our Article")
                ->description("About Description of the article")                
                ->canonical("https://www.domaine.com")
                ->toArray();
    //array(1) {
    //  ["title"]=>"Welcome To our Article",
    //  ["description"]=>"About Description of the article",
    //  ["canonical"]=>"https://www.domaine.com",
    // }