quintype/meta
Composer 安装命令:
composer require quintype/meta
包简介
A package that makes it easy to add meta tags to your views. Includes easy Laravel integration.
README 文档
README
#Meta
A package that makes it easy to add meta tags to your views.
This package will work in any PHP application, and Facades and Service Providers are provided to make it easy to integrate with Laravel 4.
Installation
General
Run the following Composer command in your terminal, or simply add 'Quintype/meta': '1.1.*' to your composer.json file:
composer require Quintype/meta:'1.1.*'
Then update Composer from the terminal:
composer update
Laravel Specific
This package also includes Laravel facades and service providers to make integration with Laravel easy.
Once complete, you now have to add the the service provider to the providers array in app/config/app.php:
'Quintype\Meta\MetaServiceProvider'
Finally, add the following entry entry to the aliases array in app/config/app.php:
'Meta' => 'Quintype\Meta\Facades\Meta'
That's it!
Usage
General
To set meta tag values, you will use the set(array()) method on the Meta instance. Just pass this Meta object around to persist the set values.
$meta = new \Quintype\Meta\Meta;
// Example #1 - Basic setting of values
$meta->set(array('title' => 'Page Title', 'description' => 'Page Description', 'keywords' => array('great', 'site')));
// Example #2 - Setting nested values. This will render tags with names like og:title and og:description
$meta->set(array('title' => 'Page Title', 'og' => array('title' => 'OG Title', 'description' => 'OG Description')));
To display your meta tags using the set values, you will use the display(array()) function on your Meta object.:
$meta->display();
// Displaying Example #1 from above
<meta name="title" content="Page Title"/>
<meta name="description" content="Page Description"/>
<meta name="keywords" content="great, site"/>
// Displaying Example #2 from above
<meta name="title" content="Page Title"/>
<meta name="og:title" content="OG Title"/>
<meta name="og:description" content="OG Description"/>
Laravel Specific
To set meta tag values, you will use the Meta::set(array()) function. Any set values will persist through the entire request of the application:
// Example #1 - Basic setting of values
Meta::set(array('title' => 'Page Title', 'description' => 'Page Description', 'keywords' => array('great', 'site')));
// Example #2 - Setting nested values. This will render tags with names like og:title and og:description
Meta::set(array('title' => 'Page Title', 'og' => array('title' => 'OG Title', 'description' => 'OG Description')));
To display your meta tags using the set values, you will use the Meta::display(array()) function. This will normally be done in your layout or in other views:
Meta::display();
// Displaying Example #1 from above
<meta name="title" content="Page Title"/>
<meta name="description" content="Page Description"/>
<meta name="keywords" content="great, site"/>
// Displaying Example #2 from above
<meta name="title" content="Page Title"/>
<meta name="og:title" content="OG Title"/>
<meta name="og:description" content="OG Description"/>
The display function also accepts an array of default values. These will be used when displaying your meta tags if a value is not set already using set().
quintype/meta 适用场景与选型建议
quintype/meta 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15.71k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 10 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「view」 「laravel」 「meta」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 quintype/meta 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 quintype/meta 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 quintype/meta 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
Harvest statistics and meta data from an URL or his source code (seo oriented).
Phalcon PHP Meta tags service
A SilverStripe module to optimise the Meta, crawling, indexing, and sharing of your website content (forked from Cyber-Duck/Silverstripe-SEO)
Help to manage meta data on Laravel Eloquent model
A simple, repeatable field type
统计信息
- 总下载量: 15.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-14