承接 gercoli/metatags 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gercoli/metatags

Composer 安装命令:

composer require gercoli/metatags

包简介

Wrapper for the HTMLTags class geared toward meta tags.

README 文档

README

An extension for GErcoli/HTMLTags to make managing common meta tags easier.

Installation

Include this into your composer.json file:

{
    "require": {
        "gercoli/metatags": "dev-master"
    }
}

Using the class

The MetaTags class uses fully qualified name spaces, so for easier use, add use GErcoli\MetaTags\MetaTags into your php file. Secondly, the class has been designed to be used statically and the various setter methods can be chained together.

Example of a simple tag

    MetaTags::setTitle("This is the page title");

    echo MetaTags::getTitle();
    // output:
    // "This is the page title"

    MetaTags::renderTitle();
    // output:
    // <title>This is the page title</title>

    MetaTags::setCharset("UTF-8")
        ->setDescription("This is the page \"description\".")
        ->renderAll();
    // output:
    //  <meta charset="UTF-8">
    //  <title>This is the page title</title>
    //  <meta name="description" content="This is the page &quot;description&quot;.">

Custom tags

It is inevitable that there will tags that you need to output/render that do not have easy-to-access class methods, for this purpose I've added the addCustomTag(HTMLTag) method, where you can use the dependant class \GErcoli\HTMLTags\HTMLTag to create an HTMLTag and insert it manually.

    // Create the custom tag via the HTMLTag class:
    $tag = (new HTMLTag("meta"))
        ->setAttribute("http-equiv","Content-Language")
        ->setAttribute("content","en");

    // Add the created tag to the MetaTags object,
    // and render only the very last tag that was added:
    MetaTags::addCustomTag($tag)->renderLast();

    // output:
    // <meta http-equiv="Content-Language" content="en">

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固