定制 kodols/php-mysql-library 二次开发

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

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

kodols/php-mysql-library

最新稳定版本:v1.2.0

Composer 安装命令:

composer require kodols/php-mysql-library

包简介

A Simple MySQL Library for PHP

README 文档

README

Build Status Latest Stable Version Total Downloads License

This library will give you access to everything you need from MySQL in PHP.

See our Object Reference to learn what is possible, or view our demo folder for examples.

About

The library is a hybrid between PHP's PDO and generic query building.

Started as a helper class for in-house projects and grown into a usefull tool for Kodols Ltd. A decision was made to make this library public give others the chance to use a well oriented library for database management.

Library will keep getting support and upgrades as this has been become the goto library for Kodols Ltd. to use for our projects.

This library supports access to the native PDO methods, few helper methods to simplify commonly used methods and a query builder to really give you access to build cool statements.

Prerequisites

This library will work on PHP 5.4 or later

Installing

You can clone this git repository into your project

git clone git://github.com/kodols/PHP-MySQL-Library.git

or you can use composer

composer require kodols/php-mysql-library

Deployment

The integration process is very simple, you call the main library class, add a configuration and you are all set. However we would recommend spend some time to really prepare the environment so you get the best out of this library. The library is based in src/ with its namespace \Kodols\MySQL. In our examples we will use a demo variable $KML (Kodols MySQL Library), but of course you can use any variable you like.

$KML = new \Kodols\MySQL\Library;

Once you have successfuly create the object you need to add MySQL connection details to it. The library supports multiple configurations attached and multiple connections established in the same request.

$config = $KML->newConfiguration();
$config->setHostname('my.host.com');
$config->setUsername('web');
$config->setPassword('42412');
$config->setDatabase('project');

The $config variable is \Kodols\MySQL\Configuration object, see Wiki for in depth details.

Once configuration is created you can attach it to the main library via $KML->attachConfiguration($config); and start using the library. However if your environment has multiple database endpoints, or maybe you have production, development and local environment, then you can setup it as follows:

$config = $KML->newConfiguration();
$config->setHostname('my.host.com');
...
$KML->attachConfiguration($config, 'live');

So when you call the server variable you can choose with of the server endpoints you want to use.

Contributors

We welcome a good idea, bug fixes, suggestions and requests. This list will be updated every time a new contribution has been made.

License

This project is licensed under the MIT License - see the https://github.com/kodols/php-mysql-library/blob/master/LICENSE file for details

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 3
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-24