定制 apsxj/mysql 二次开发

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

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

apsxj/mysql

Composer 安装命令:

composer require apsxj/mysql

包简介

MySQL Library for APSXJ Server

README 文档

README

MySQL Library for APSXJ Server

Getting Started

  1. Add the following to your composer.json file:
  "require": {
    "apsxj/mysql": "dev-main"
  },
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/apsxj/mysql.git"
    }
  ]
  1. Run composer install

  2. Before calling any of the methods, require the vendor autoloader

// For example, from the root directory...
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
  1. Extend the Connection class
<?php

class Connection extends \apsxj\mysql\Connection 
{
  public function __construct()
  {
    parent::__construct(
      'localhost',
      'test_db',
      'test_user',
      'supersecret'
    );
  }
}

$connection = new Connection();

$rows = $connection->fetch("SELECT * FROM `test_table`;");
  1. Extend the Table class
<?php

use apsxj\mysql\Column;
use apsxj\mysql\Type;

class Table extends \apsxj\mysql\Table
{
  public function __construct()
  {
    parent::__construct(
      new Connection(),
      'test',
      array(
        new Column('id', Type::INT),
        new Column('created', Type::INT),
        new Column('updated', Type::INT),
        new Column('deleted', Type::BOOL),
        new Column('name')
      )
    );
  }

  public function insert($name)
  {
    $sql = "INSERT INTO `test` (`id`, `created`, `updated`, `deleted`, `name`) VALUES (NULL, ?, ?, 0, ?);";
    $date = date('U');
    $args = array($date, $date, $name);
    return $this->connection->insert($sql, $args);
  }
}

$table = new Table();

$table->insert('Test Name');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固