定制 webmgine/database-object 二次开发

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

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

webmgine/database-object

Composer 安装命令:

composer require webmgine/database-object

包简介

Simple custom PHP mysql/mariaDb object

README 文档

README

Simple custom PHP mysql/mariaDb object

Getting Started

Use composer autload (or include src/DatabaseObject.php in your project).

require __DIR__ . '/vendor/autoload.php';

Create database object instance

$databaseInfo = [
    'host' => 'database host',
    'name' => 'database name',
    'user' => 'database user',
    'pass' => 'database pass',
    'port' => 3306, // Optional, default = 3306
    'encoding' => 'UTF8' // Optional, default = 'UTF8',
    'prefix' => '' // Optional, default = '', used to prefix tables in a shared database environment
];
$dbo = new Webmgine\DatabaseObject($databaseInfo);

If you set a prefix, use #__ in front of your table name when writing query.

$dbo->from('#__table_name'); // #__ will be replaced by your prefix, with default prefix set, #__table_name will become table_name

You can change the #__ for anything else using setPrefixTarget method

$dbo->setPrefixTarget('!!!_');

Query are saved inside the object, remember to empty the saved values before making a new query

$dbo->newQuery();

Select query

Exemple:

$dbo->newQuery();
$dbo->select('*');
$dbo->from('#__exemple_table');
$dbo->where('demo=:demo');
$dbo->execute([
    'demo' => $demo
]);
$singleResult = $dbo->getResult(); // Return one result, if many, return the first
$resultsArray = $dbo->getResults(); // Return all results in a array

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固