protocollive/phplivedb
最新稳定版本:1.2.0
Composer 安装命令:
composer require protocollive/phplivedb
包简介
A library to easy handling with database
README 文档
README
Using large querys with PDO, you have a lot of fields and placeholders... Using insert with ordered placeholders, it's worse, because you don't know which placeholder is which field...
$pdo->prepare(" insert into users('id', 'name', 'email', 'password', 'address', 'country', 'zipcode', 'telephone', 'gender', 'register_date', 'last_login', 'last_pass_change') values(?,?,?,?,?,?,?,?,?,?,?,?) ");
That's a simple example. We know there are a lot of bigger queries out there... What if I need to add a new field? Just add the field name and one more placeholder. What if PDO throws an error saying different placeholder fields and numbers? I'd have to count them one by one...
Named placeholders help with this. Okay, but that's a lot of lines to write and manage... This library helps with that:
$db->Insert('users') ->FieldAdd('id', $id, Types::Int) ->FieldAdd('name', $name, Types::Str) ->FieldAdd('email', $email, Types::Str) ->FieldAdd('password', $password, Types::Str) ->FieldAdd('address', $address, Types::Str) ->FieldAdd('country', $country, Types::Str) ->FieldAdd('zipcode', $zipcode, Types::Str) ->FieldAdd('telephone', $telephone, Types::Str) ->FieldAdd('gender', $gender, Types::Str) ->FieldAdd('register_date', $register_date, Types::Str) ->FieldAdd('last_login', $last_login, Types::Int) ->FieldAdd('last_pass_change', $last_pass_change, Types::Int) ->Run();
This was the initial idea of the library that was expanded according to my needs and today it is a very complete library (if not, feedbacks are welcome) that I use in my daily life and share with the world.
For the documentation, click here.
Install
- Download the library in zip format and use the src folder content;
- Via Composer with
composer require protocollive/phplivedb(Video);
统计信息
- 总下载量: 664
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-17