anekdotes/formwrapper
Composer 安装命令:
composer require anekdotes/formwrapper
包简介
Allows wrapping of form controls.
README 文档
README
Allows instantiation of standardized custom form wrappers. Eases extandability of new wrappers.
Installation
Install via composer into your project:
composer require anekdotes/formwrapper
Please note that using composer allows easy namespacing for using classes later on. Following examples use a composer based namespace autoloading.
Basic Usage
$form = new Anekdotes\FormWrapper\Form; echo($form->open('www.toaster.com', post, ["class" => "form"])); echo($form->Text('label', 'toaster', ["class" => "form-stuff"], 'val')); echo($form->close());
will output
<form action="www.toaster.com" method="form" class="form"> <input type="text" name="toaster" value="val class="form-stuff" /> </form>
All built-in Controls and Wrappers can be found in the folder examples. To have the required namespaces autoloaded, you will need to run composer install
Extending Controls and Wrappers
It is possible to write your own controls and wrappers and use them.
namespace MyCustomWrapper; use Anekdotes\FormWrapper\Wrappers\Wrapper; class MyWrapper extends Wrapper { public function handle($input, $title = '') { return '<div class="MyCustomLabel">'.$title.'</div><div>'.$input.'</div>'; } }
namespace MyCustomControl; use Anekdotes\FormWrapper\Controls\Control; class MyControl extends Control { protected $nbParams = 1; public function prepare($arguments) { $name = $arguments[0]; return '<input type="text" value="'.$name.'" name="'.$name.'"/>'; } }
$form = new Anekdotes\FormWrapper\Form; $form->wrappersNamespace = 'MyCustomWrapper//'; $form->controlsNamespace = 'MyCustomControl//'; echo($form->open('www.toaster.com', post, ["class" => "form"])); echo($form->MyControl('toaster', 'toaster', 'MyWrapper')); echo($form->close());
Contributing
Pull requests are welcome. Note that if you want to develop the scss files, you will need to install npm dependencies using npm install. You will then need to use gulp to compile the CSS.
Pull requests must have tests included (excepted for the scss). If no tests are to be found, if the pull request does not pass the current test suite or if the tests do not cover enough cases, the pull requests may not be merged.
Examples
The folder /examples contains PHP examples of a lot of wrappers in use. (pre-built + customs).
To see them in browser, you'll need to bootup a php server pointing on the examples folder and running composer install at the root of this project.
Note
Most of the pre-built wrappers use css classes from Bootstrap.
anekdotes/formwrapper 适用场景与选型建议
anekdotes/formwrapper 是一款 基于 CSS 开发的 Composer 扩展包,目前已累计 560 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 07 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「form」 「wrapper」 「controls」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 anekdotes/formwrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 anekdotes/formwrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 anekdotes/formwrapper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Contributte UI. Opinionated prime components for your Nette applications.
Extension for Nette Framework: Controls: that has not translatable content (radiolist, selectbox), custom label text input
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
Edit Posts button always visible
统计信息
- 总下载量: 560
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-18