thecsea/mysqltcs
Composer 安装命令:
composer require thecsea/mysqltcs
包简介
The simplest and the most powerful library to access to a mysql database, optimizing the connections and allowing you to perform common database actions immediately and efficiently
README 文档
README
The simplest and the most powerful library for mysql written in php:
- You can use the same db connection in more than one instances (optimizing mysql physical connections)
- This library allow you to make common database operations immediately and efficiently, returning simple data structures
- Log all actions performed on db
- All mysql error as exception
- Clone support
- Transactions support
Download, install and use
Download
via git
Clone repository
git clone https://github.com/thecsea/mysqltcs.git
via composer
download composer here https://getcomposer.org/
add the following dependence in composer.json
"thecsea/mysqltcs": "3.0.*"
or type
php composer.phar require thecsea/mysqltcs
##Install/Update Update composer (download composer here https://getcomposer.org/)
php composer.phar self-update
Followings commands must be executed in project root directory
###Install mysqltcs
php composer.phar install
###Update mysqltcs
You can perform an updated if you have added mysqltcs as composer dependency
php composer.phar update
You have to perform an update when a new version is released
##How to use
When composer installation is finished you will see vendor/autoload.php that is the auload generated by composer. If you have set mysqltcs as composer dependence the autoload loads both mysqltcs and other dependecies. So you just have to include autload in each file where you want use mysqltcs and create the mysqtcs object in the following way:
$connection = new it\thecsea\mysqltcs\Mysqltcs(...);
or
use it\thecsea\mysqltcs\Mysqltcs; and $connection = new Mysqltcs(...);
You can see examples to understand how to use library
You can also take a look to wiki to see the detailed description or go to generated phpdoc documents (documentations of all classes)
Tests
Mysqltcs is tested with automatic test: phpunit test. So we have a good chance of not having errors, but not the
certainty.
But we have covered the following percentage of statements with tests:
- Change db data in
tests/config.php - Import
tests/mysqltcs.sql - Execute the unit tests:
- Go in the root directory
- Type
phpunitor if you have downloaded the pharphp phpunit-xxx.phar
In fact phpunit.xml contains the correct test configuration
CAUTION: each time tests are executed, the database must be in the initial state, like the import has just been executed (you should have a empty table, only the db structure)
#Examples
You can find some examples under examples to run it:
- Change db data in
examples/config.php - Import
examples/mysqltcs.sql
There is a simple example simpleExample.php that shows you how to use the library in the simplest way
There are not examples about transactions yet (you have to remember to set autocommit to true after using transactions)
N.B. if you have added mysqltcs as composer dependency you will find example under vendor/thecsea/mysqltcs/examples
By thecsea.it
thecsea/mysqltcs 适用场景与选型建议
thecsea/mysqltcs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 255 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「mysql」 「Simple」 「efficient」 「optimized」 「powerful」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 thecsea/mysqltcs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thecsea/mysqltcs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 thecsea/mysqltcs 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
An extremely fast web scraper that parses megabytes of HTML in a blink of an eye. No dependencies. PHP5+
Dibi is Database Abstraction Library for PHP
A simple library for make Lexer and Parsers to build a language
A simple library that allows transform any kind of data to native php data or whatever
A simple library that uses the hydration pattern to fill objects given different sources of data.
Micro Active Record library in PHP, support chain calls, events, and relations.
统计信息
- 总下载量: 255
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 20
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2015-06-03