beastbytes/yii2-microformats
Composer 安装命令:
composer require beastbytes/yii2-microformats
包简介
Yii2 Widget to generate microformats2 from model data
README 文档
README
This extension is a Yii2 Widget to generate microformats from model data; also included is a Formatter class for formatting of WGS84 coordinates.
For license information check the LICENSE-file.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist beastbytes/yii2-microformats
or add
"beastbytes/yii2-microformats": "~1.0.0"
to the require section of your composer.json.
Usage
Use this extension in a view in a similar way to yii\widgets\DetailView (it's a child class of DetailView).
Let's generate an "h-card" from a user model - $user - that has the following relations:
- profile - that stores the user's name
- address - for the user's address
- phone - for the user's phone number
In the view:
echo Microformat::widget([ 'microformat' => 'h-card', // name of the microformat 'model' => $user, // the model that provides the data 'attributes' => [ / the attributes array specifies the microformat properties 'p-name:profile.name', // get the user's name from the profile relation 'p-email', 'p-tel:phone.value', [ // Additional markup that is not a microformat property 'value' => 'Address', 'template' => '<div class="h-card__title">{value}</div>' // with it's own template ], [ 'property' => 'p-adr', 'microformat' => 'h-adr, // Markup the address with an embedded h-adr microformat 'model' => $user->address, // we can specify a new model for embedded microformats; if not given the parent microformat model is used 'template' => '<div {options}>{value}</div>', // a new template for h-adr 'attributes' => [ 'p-street-address', // fetch data from $user->address->street_address 'p-locality', 'p-region', 'p-postal-code', [ 'property' => 'p-geo', 'microformat' => 'h-geo', 'template' => '<div><span>{label}</span><data {options} value="{rawValue}">{value}</data></div>', 'formatter' => [ // use the included formatter for latitude and longitude 'class' => '\\beastbytes\\microformats\\Formatter', 'coordinateFormat' => '%02d %02.6f h' ], 'attributes' => [ 'property' => 'p-latitude:latitude:latitude', // microformat property:model attribte:format 'property' => 'p-longitude:longitude:longitude' ] ] ] ] ] ]);
See the source code for more configuration details.
beastbytes/yii2-microformats 适用场景与选型建议
beastbytes/yii2-microformats 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 48 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 07 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「microformats」 「widget」 「yii2」 「microformats2」 「microformat」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 beastbytes/yii2-microformats 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 beastbytes/yii2-microformats 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 beastbytes/yii2-microformats 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A custom URL rule class for Yii 2 which allows to create translated URL rules
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
A PHP library to parse webmentions from HTML
Add a weather widget to Flarum
统计信息
- 总下载量: 48
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-07-26