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 "description".">
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">
gercoli/metatags 适用场景与选型建议
gercoli/metatags 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 gercoli/metatags 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gercoli/metatags 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-21