定制 elzekool/fluent_dbal 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

elzekool/fluent_dbal

Composer 安装命令:

composer require elzekool/fluent_dbal

包简介

Easy to use and framework independant fluent database abstraction layer on top of PDO.

README 文档

README

FluentDbal is an easy to use and framework independant fluent database abstraction layer on top of PDO. It helps you to structure database queries easly without creating overhead.

Key features

  • Allows reusing prepared statements
  • Lightweight
  • Promotes use of prepared statements, preventing SQL injection hacks

Starting with FluentDbal

  1. Make sure PHP 5.3.* is installed
  2. Install FluentDbal using Composer or manually
  3. Create a PDO instance
  4. Create instance of FluentDbal
  5. Use FluentDbal to create queries (sharing PDO connection)

Example

$pdo = new \PDO('mysql:host=127.0.0.1;dbname=world', '', '');

$dbal = new FluentDbal($pdo);

$query = $dbal
    ->newQuery()
    ->select('city.Name,country.name, city.District')
    ->from('city')
    ->leftJoin('country', 'country.Code = city.CountryCode')
    ->where('city.CountryCode = ?', 'NLD')        
        
    // Orderby can be repeated
    ->orderby('city.Population','DESC')
    ->orderby('city.Name','ASC')
        
    ->limit(1);
    
$city = $query->execute();

print_r($city->fetch());
// stdClass Object
// (
//    [Name] => Amsterdam
//    [name] => Netherlands
//    [District] => Noord-Holland
// )

Changelog

11-09-2013: Allow usage of named parameters while building query For the functions custom, set, where it is now posible to directly add named parameters, to use this add just one parameter of the type array, with the key as parameter name. If you need to set multiple parameters add this in the same array. It is NOT posible to mix numbered and named parameters.

Example: ->where('city.CountryCode = :cc', array(':cc' => 'NLD'))

License

(MIT License)

Copyright (c) 2013 Elze Kool info@kooldevelopment.nl

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

统计信息

  • 总下载量: 48
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-07-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固