定制 fterenzani/lazypdo 二次开发

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

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

fterenzani/lazypdo

Composer 安装命令:

composer require fterenzani/lazypdo

包简介

Just a bit of sugar in PDO

README 文档

README

// Lazy database connection
$lazyPdo = new \LazyPdo\Lazy('sqlite:::memory:');

// Normal connection
$notLazyPdo = new \LazyPdo\Pdo('sqlite:::memory:');

// It is the equivalent of
// $pdo = new PDO('sqlite:::memory:');
// $pdo->setAttribute(\PDO::ATTR_ERRMODE , \PDO::ERRMODE_EXCEPTION);
// $pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_OBJ);

$lazyPdo instanceof \LazyPdo\LazyPdo; // true
$notLazyPdo instanceof \LazyPdo\LazyPdo; // true

$lazyPdo instanceof \PDO; // true
$notLazyPdo instanceof \PDO; // true

// Get the instance of \PDO
$pdo = $lazyPdo->getPdo();

// Shorthand method
$results = $lazyPdo->query($sql, array($vars, $to, $bind));

// It is the equivalent of:
// $stmt = $pdo->prepare($sql);
// $stmt->execute(array($vars, $to, $bind));
// $results = $stmt;

// Shorthand method
$affectedRows = $lazyPdo->exec($sql, array($vars, $to, $bind));

// It is the equivalent of:
// $stmt = $pdo->prepare($sql);
// $stmt->execute(array($vars, $to, $bind));
// $affectedRows = $stmt->rowCount();

$stmt = $lazyPdo->query($sql, array($vars, $to, $bind));

$stmt->fetchObjects('\My\CustomClass', array($constructor, $arguments));
// It is the equivalent of:
$stmt->fetchAll(\PDO::FETCH_CLASS, '\My\CustomClass', array($constructor, $arguments));

$stmt->fetchColumns(0);
// It is the equivalent of:
$stmt->fetchAll(\PDO::FETCH_COLUMN);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL
  • 更新时间: 2014-07-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固