indatus/widgets
Composer 安装命令:
composer require indatus/widgets
包简介
README 文档
README
A helper library that includes methods for generating the HTML for labels, select fields, text fields, links, and tables.
Installation
With Composer
Add the following to your composer.json then run composer install
{
"require": {
"indatus/widgets": "dev-master"
}
}
Register the service provider in app/config/app.php
[...]
'providers' => array(
[...]
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
'Indatus\Widgets\WidgetsServiceProvider'
),
[...]
Widget Gallery
Table
Tables can be created from multi-dimentional arrays. The keys will serve as the titles to be displayed in the table header. Additional options may be passed in the options parameter to be applied to the table element.
Data in controller passed to the view.
$data = [ ['name' => 'Alex', 'occupation' => 'Engineer'], ['name' => 'Judy', 'occupation' => 'Analyst'], ['name' => 'Pam', 'occupation' => 'Coach'] ]; $options = ['class' => 'table'];
Using the table generator inside of the blade template.
{{ Indatus\Widgets\Table::generate($data, $options) }}
The resulting HTML.
<table class="table"> <thead> <tr> <td>Name</td> <td>Occupation</td> </tr> </thead> <tbody> <tr> <td>Alex</td> <td>Engineer</td> </tr> <tr> <td>Judy</td> <td>Analyst</td> </tr> <tr> <td>Pam</td> <td>Coach</td> </tr> </tbody> </table>
Select
Data in controller passed to the view.
$select = [ 'Red' => 1, 'Orange' => 2, 'Yellow' => 3, 'Green' => 4, 'Blue' => 5, 'Indigio' => 6, 'Violet' => 7 ]; $selected = 5; // Used to set what option will be selected.
Using the select generator inside of the blade template.
{{ Indatus\Widgets\Select::generate($select, $selected) }}
The resulting HTML
<select> <option value="1">Red</option> <option value="2">Orange</option> <option value="3">Yellow</option> <option value="4">Green</option> <option value="5" selected="">Blue</option> <option value="6">Indigio</option> <option value="7">Violet</option> </select>
Label and Input
Using the label and input generator inside of the blade template.
{{ Indatus\Widgets\Label::generate('Email', 'email', ['class' => 'loud']) }} {{ Indatus\Widgets\TextField::generate('email', null, ['class' => 'email']) }} {{ Indatus\Widgets\TextField::generate('name', 'Steve') }}
The resulting HTML
<label for="email" class="loud">Email</label> <input type="text" name="email" id="email" class="email"> <input type="text" name="name" id="name" value="Steve">
Link
Using the link generator inside of the blade template.
{{ Indatus\Widgets\Link::generate('Google', 'http://google.com/', ['class' => 'outbound']) }}
The resulting HTML
<a href="http://google.com/" class="outbound">Google</a>
Assets
To publish this package's assets to run the artisan publish command targeting this package.
php artisan asset:publish indatus/widgets
Then to include the assets use the following inside of your templates
{{ Indatus\Widgets\Asset::scripts() }} {{ Indatus\Widgets\Asset::styles() }}
The resulting HTML
<script src="http://application-hostname.com/packages/indatus/widgets/widgets.js"></script> <link rel="stylesheet" href="http://application-hostname.com/packages/indatus/widgets/widgets.css">
indatus/widgets 适用场景与选型建议
indatus/widgets 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 12 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 indatus/widgets 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 indatus/widgets 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-12-30