litto/mysqli-lib
Composer 安装命令:
composer require litto/mysqli-lib
包简介
CRUD Function Library based on Mysqli for PHP applications
README 文档
README
Mysqli Library for CRUD Functions
When you do a project in php related to web, the main thing you have to came across is the management of database.This all functions including,connecting to database,retreiving values from databse,deleting,updating,inserting....etc.. so by including the library file iam providing below, you can just call that functions in your code and do all operations very fast without manually writing functions again and again:-
How to Install?
Install the Library via composer using:-
composer require litto/mysqli-lib:v1.0
Folder Structure
-config.php // including connection variables which will be autoloading by the Mysql libraries and classes -autoload.php // autoload classes by declaration from libs library -demo.php // demo on how to initilise and call each functions -/libs // folder for saving all lib files
How it Works?
- Zip the package to your Website root
- Make sure config.php, autoload.php files are in root and libs folder contains Mysql.php library file
- Now in your file include both config an autoload files.
- In config.php file, please update your db credentials
- Now we have to create library files for your database tables by defining library functions extending Mysql
for eg:- If you have a cms_user table, for defining functions for DB transactions for this table define library like this.
$inputs['name'],'tel'=>$inputs['tel'],'email'=>$inputs['email']); $this->insert($insert,"cms_user"); return true; } //Update Record function updateContent($inputs){ $insert = array( 'name'=>$inputs['name'],'tel'=>$inputs['tel'],'email'=>$inputs['email']); $this->update($insert,"cms_user",'`id`='.$inputs['id']); return true; } //Get all records function getall(){ $query = 'SELECT * FROM `cms_user` '; $rec = $this->fetchAll($query); return $rec; } //Get details of Record function getrecord($id){ $query = 'SELECT * FROM `cms_user` WHERE `id`='.$id.' '; $rec = $this->fetchAll($query); return $rec; } //Delete record function deleterecord($id){ $this->delete('cms_user','`id`='.$id); } } ?>- Now For calling these Function , suppose in your index.php file..
You just have to intilize it like:-
$obj=new User(); $records=$obj->getall();
or $record=$obj->getdetails($id);
Like this you can call, all the functions defined...
- Make class files for all the tables you need..
litto/mysqli-lib 适用场景与选型建议
litto/mysqli-lib 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 02 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 litto/mysqli-lib 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 litto/mysqli-lib 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2022-02-07