arousacode/webapp_liblet
Composer 安装命令:
composer require arousacode/webapp_liblet
包简介
Small library to automatically load data from HTMl form in any PHP object, and to generate HTML inputs from it. Also load and store into PDO database.
关键字:
README 文档
README
Small library to automatically :
- load data from HTMl form in any PHP object, and to generate HTML inputs from it.
- load and store data from/to the object using PDO database.
In orther to be able to manage HTMl form data in a PHP object, and to store it in a PDFO database:
PHP example
require_once('../../vendor/autoload.php'); use ArousaCode\WebApp\Types\Date; use ArousaCode\WebApp\Types\Time; use ArousaCode\WebApp\Types\DateTime; use ArousaCode\WebApp\Types\TextArea; use ArousaCode\WebApp\Types\Hidden; class Operation { use \ArousaCode\WebApp\Html\Form; #[Hidden] public ?string $operation='SAVE'; #[Hidden] public ?string $mode=null; } class UserData { use \ArousaCode\WebApp\Html\Form; use \ArousaCode\WebApp\Pdo\PDOExtended; public ?int $id; public string $sureName; public int $age; public float $height; #[DateTime] public \DateTime $dateOfBirth; #[Time] public \DateTime $exitTime; #[Date] public \DateTime $birthDay; #[TextArea] public string $description; public bool $chief; public ?bool $question; } $operation = new Operation(); $operation->loadData(INPUT_POST); $userData = new UserData(); $userData->initDb(new \PDO("pgsql:dbname=webapp;host=webapp-postgresql","webapp","webapp")); switch ($operation->operation) { case 'SAVE': $userData->loadData(INPUT_POST); $userData->upsert(); break; case 'DELETE': $userData->loadData(INPUT_POST); $userData->delete(); break; case 'COPY': $userData->id = null; break; default: //No operation requested: We expecto to get an ID passed by GET $userData->id = filter_input(INPUT_GET, 'id'); break; } if($userData->id != null){ //If there is an ID, we load the data from database. ALso if we have just stored it. $userData->load(); } /* if (isset($_POST['save'])) { echo "<pre> DEBUG: RECEIVED userData :\n-------------\n"; print_r($userData); echo "</pre>"; }*/ ?> <html> <form method='POST'> <?php $userData->printHtmlInputField('operation'); ?> <?php $userData->printHtmlInputField('mode'); ?> <input type='button' value='GARDAR' onclick="operation.value='SAVE';submit()"/> <input type='button' value='BORRAR' onclick="operation.value='DELETE';submit()"/> <input type='button' value='COPIAR' onclick="operation.value='COPY';submit()"/> <br /> ID <?php $userData->printHtmlInputField(name: 'id', elementExtraAttributes:' readonly ' ); ?> <br /> Name <?php $userData->printHtmlInputField('sureName'); ?> <br /> Age <?php $userData->printHtmlInputField('age'); ?> <br /> height <?php $userData->printHtmlInputField('height'); ?> <br /> datebir<?php $userData->printHtmlInputField('dateOfBirth'); ?> <br /> exit time<?php $userData->printHtmlInputField('exitTime'); ?> <br /> birthday<?php $userData->printHtmlInputField('birthDay'); ?> <br /> desc <?php $userData->printHtmlInputField('description'); ?> <br /> chief <?php $userData->printHtmlInputField('chief'); ?> <br /> question<?php $userData->printHtmlInputField('question'); ?> <br /> <input type='button' value='GARDAR' onclick="operation.value='SAVE';submit()"/> <input type='button' value='BORRAR' onclick="operation.value='DELETE';submit()"/> <input type='button' value='COPIAR' onclick="operation.value='COPY';submit()"/> </form> </html>
The rendered HTMl Form will have this aspect:
HTML Form rendered
arousacode/webapp_liblet 适用场景与选型建议
arousacode/webapp_liblet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 06 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「orm」 「form」 「html」 「pdo」 「Reflexion」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 arousacode/webapp_liblet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arousacode/webapp_liblet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 arousacode/webapp_liblet 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Kinikit - PHP Application development framework MVC component
PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2
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.
HTML and form generation
A Laravel Filament Forms slug field.
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2022-06-15