承接 kroyxlab/datbazo 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kroyxlab/datbazo

Composer 安装命令:

composer require kroyxlab/datbazo

包简介

DatBazo(Datuma Bazo, Database in Esperanto) is a SQL-query constructor using PDO.

README 文档

README

DatBazo

DatBazo(Datuma Bazo, Database in Esperanto) is a SQL-query constructor using PDO. is a small library with which you can quickly create queries to the database using the "Prepare" and "Execute" methods of PDO to avoid sql injections.

Table of contents

  1. Dependencies
  2. Install
  3. Getting started
  4. Methods
  5. Author
  6. License

Dependencies

This package requires PHP 7 or higher.

Install

via composer

composer require kroyxlab/datbazo

Copy repository

Copy the direct repository to your project and require the class.

require_once 'proyect_directory/datbazo/src/DatBazo.php';
use kroyxlab\datbazo\DatBazo as DatBazo;

Getting started

Modify the KLPdo.ini file located in the folder vendor/kroyxlab/datbazo/src/DBconfig.ini and modify the values to configure the connection to the database.

[databazo]
db_driver = Mysql || sqlite3 || pgsql
db_host = Host_name
db_port = Port
db_name = Database_name
db_user = user
db_password = password
db_charset = UTF8

If everything is configured correctly, you can start using the library.

require_once "vendor/autoload.php";
use kroyxlab\datbazo\DatBazo as DatBazo;

// instantiate the DatBazo class
$productos = new DatBazo;

// Create an SQL statement using the methods of the KLPdo class
$products->select(['products'=>'name, price'])
          ->where(['price'=>['>=', 12.5]])
          ->order('price')
          ->execute();

// Set the type of fetch you want.
$products->fetch('assoc');

// Use the Method -> render (); to output and format the result of the sql query
$products->render(function($product){

  return "<p>The name of the product is {$product['name']} and the price is {$product['price']}</p>";

});

// Or use a foreach loop using the fetch method

foreach($products->fecth('obj') as $product){
  echo "<p>The name of the product is $product->name and the price is $product->price</p>"
}

Methods

The methods of the DatBazo class help to create an SQL statement which will be executed through the prepare and execute methods of Pdo to avoid SQL injections.

List of methods:

Author

License

This project is licensed under the MIT License - see the MIT.md file for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固