bonzer/inputs
Composer 安装命令:
composer require bonzer/inputs
包简介
A form inputs library
README 文档
README
A utility Library with minimal interface giving you the ability to create HTML form fields with added functionality.
Form Fields included are
- text
- multi-text
- multi-text-calendar
- textarea
- select
- multi-select
- icon
- color
- calendar
- heading
- radio
- checkbox
Getting Started
Prerequisites
-
PHP - the following PHP dependencies are required for complete working of form fields
- PHP >= 5.4
- "bonzer/exceptions" : "dev-master"
- "oyejorge/less.php" : "v1.7.0.14"
-
Javascript - the following javacsript dependencies are required for complete working of form fields
- jquery
- jquery-ui
(Includes: draggable, core, resizable, selectable, sortable, datepicker, menu, selectmenu, button, tooltip) - chosen (Multi Select)
- spectrum (Color Picker)
-
CSS - the following CSS dependencies are required for complete working of form fields
- font-awesome
- jquery-ui
- jquery-ui.theme
(Includes: draggable, core, resizable, selectable, sortable, datepicker, menu, selectmenu, button, tooltip, theme) - chosen (Multi Select)
- spectrum (Color Picker)
Installing
It can be installed via composer. Run
composer require bonzer/inputs
Configuration
Bonzer\Inputs\config\Configurer::get_instance([
'load_assets_automatically' => true, // recommended option is false, I have made it true so that library does not break if you don't configure
'css_excluded' => [ ], // keys for js files you don't want the library to load, You should be responsible for loading them for library
'js_excluded' => [ ], // keys for js files you don't want the library to load, You should be responsible for loading them for library
'env' => 'production', // development | production
'is_admin' => false // flag you can set to tell library when the fields are opened in ADMIN mode, helpful for Exception handling
'style' => '1', // 1,2,3
]);
The above code must come before any code related to this Library.
- Note: keys to put in
js_excludedandcss_excludedcan be found insrc/config.phpfile
The Library come bundled with required css, js and fonts. As we all know css must go in head tag and for js,
recommended option is before </body>. For this Library is offering two methods:
$Assets_Loader = Bonzer\Inputs\Assets_Loader::get_instance();
$Assets_Loader->load_head_fragment();
$Assets_Loader->load_before_body_close_fragment();
but if you intend to use both of these options yourself, turn the 'load_assets_automatically' key in configuration to FALSE. i.e.
'load_assets_automatically' => FALSE
Usage
There is a Factory class Bonzer\Inputs\factories\Input that has create method,
The Blueprint of the Method is
/**
* --------------------------------------------------------------------------
* Create the Input field
* --------------------------------------------------------------------------
*
* @param string $type | input type ('calendar', 'checkbox', 'color', 'heading', 'icon', 'multi-select', 'multi-text', 'multi-text-calendar', 'radio', 'select', 'text', 'textarea',)
* @param array $args
*
* @Return string
* */
public function create( $type, $args );
second argument $args has blueprint as follows:
$args = [
'name' => $field_name, string
'id' => $field_id, string
'label' => $field_label, string
'placeholder' => $field_placeholder, string
'value' => $value, string
'desc' => $description, string
'options' => $options, array
'attrs' => $attrs, array
];
Examples
$input = Bonzer\Inputs\factories\Input::get_instance();
echo $input->create('text', [
'id' => 'text',
'placeholder' => 'Hello',
'value' => '',
]);
echo $input->create('icon', [
'id' => 'icon',
'placeholder' => 'select icon',
'value' => '',
]);
echo $input->create('multi-text', [
'id' => 'multi-text',
'placeholder' => 'Hello',
'value' => '',
]);
echo $input->create('calendar', [
'id' => 'calendar',
'placeholder' => 'Calendar',
'value' => '',
]);
echo $input->create('multi-text-calendar', [
'id' => 'multi-text-calendar',
'placeholder' => 'Multi Text Calendar',
'value' => '',
]);
echo $input->create('textarea', [
'id' => 'textarea',
'placeholder' => 'Textarea',
'value' => '',
]);
echo $input->create('select', [
'id' => 'select',
'options' => [
'hello' => 'Hello',
'world' => 'World',
],
]);
echo $input->create('multi-select', [
'id' => 'multi-select',
'options' => [
'hello' => 'Hello',
'world' => 'World',
],
]);
echo $input->create('color', [
'id' => 'color',
'placeholder' => 'Hello',
'value' => '',
]);
Support
If you are having issues, please let me know.
You can contact me at ralhan.paras@gmail.com
Credits
- Font Awesome
- Vector Icons -- Pixel Buddha from www.flaticon.com is licensed by CC 3.0 BY
License
The project is licensed under the MIT license.
bonzer/inputs 适用场景与选型建议
bonzer/inputs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 51 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bonzer/inputs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bonzer/inputs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 51
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-04