PHPackages                             jichangfeng/mysql - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. jichangfeng/mysql

ActiveLibrary[Database &amp; ORM](/categories/database)

jichangfeng/mysql
=================

Long-living MySQL connection for daemon.

v1.0.6(6y ago)115MITPHPPHP &gt;=5.3

Since Mar 4Pushed 5y agoCompare

[ Source](https://github.com/jichangfeng/mysql)[ Packagist](https://packagist.org/packages/jichangfeng/mysql)[ Docs](http://www.workerman.net)[ RSS](/packages/jichangfeng-mysql/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (8)Used By (0)

Workerman\\Mysql\\Connection
============================

[](#workermanmysqlconnection)

Long-living MySQL connection for daemon.

Install
=======

[](#install)

`composer require workerman/mysql`

Usage
=====

[](#usage)

```
$db = new Workerman\MySQL\Connection($mysql_host, $mysql_port, $user, $password, $db_bname);

// Get all rows.
$db1->select('ID,Sex')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->query();
// Equivalent to.
$db1->select('ID,Sex')->from('Persons')->where("sex='F'")->query();
// Equivalent to.
$db->query("SELECT ID,Sex FROM `Persons` WHERE sex='M'");

// Get one row.
$db->select('ID,Sex')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->row();
// Equivalent to.
$db->select('ID,Sex')->from('Persons')->where("sex= 'F' ")->row();
// Equivalent to.
$db->row("SELECT ID,Sex FROM `Persons` WHERE sex='M'");

// Get a column.
$db->select('ID')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->column();
// Equivalent to.
$db->select('ID')->from('Persons')->where("sex= 'F' ")->column();
// Equivalent to.
$db->column("SELECT `ID` FROM `Persons` WHERE sex='M'");

// Get single.
$db->select('ID,Sex')->from('Persons')->where('sex= :sex')->bindValues(array('sex'=>'M'))->single();
// Equivalent to.
$db->select('ID,Sex')->from('Persons')->where("sex= 'F' ")->single();
// Equivalent to.
$db->single("SELECT ID,Sex FROM `Persons` WHERE sex='M'");

// Complex query.
$db->select('*')->from('table1')->innerJoin('table2','table1.uid = table2.uid')->where('age > :age')
->groupBy(array('aid'))->having('foo="foo"')->orderByASC/*orderByDESC*/(array('did'))
->limit(10)->offset(20)->bindValues(array('age' => 13));
// Equivalent to.
$db->query(SELECT * FROM `table1` INNER JOIN `table2` ON `table1`.`uid` = `table2`.`uid` WHERE age > 13
GROUP BY aid HAVING foo="foo" ORDER BY did LIMIT 10 OFFSET 20“);

// Insert.
$insert_id = $db->insert('Persons')->cols(array(
    'Firstname'=>'abc',
    'Lastname'=>'efg',
    'Sex'=>'M',
    'Age'=>13))->query();
// Equivalent to.
$insert_id = $db->query("INSERT INTO `Persons` ( `Firstname`,`Lastname`,`Sex`,`Age`)
VALUES ( 'abc', 'efg', 'M', 13)");

// Updagte.
$row_count = $db->update('Persons')->cols(array('sex'))->where('ID=1')
->bindValue('sex', 'F')->query();
// Equivalent to.
$row_count = $db->update('Persons')->cols(array('sex'=>'F'))->where('ID=1')->query();
// Equivalent to.
$row_count = $db->query("UPDATE `Persons` SET `sex` = 'F' WHERE ID=1");

// Delete.
$row_count = $db->delete('Persons')->where('ID=9')->query();
// Equivalent to.
$row_count = $db->query("DELETE FROM `Persons` WHERE ID=9");

// Transaction.
$db1->beginTrans();
....
$db1->commitTrans(); // or $db1->rollBackTrans();
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 78.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~146 days

Total

7

Last Release

2477d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/091305370ead8ea96ed538bba46a3d6a70eebe8c16e3a272c0033cc8a3f18497?d=identicon)[jichangfeng](/maintainers/jichangfeng)

---

Top Contributors

[![walkor](https://avatars.githubusercontent.com/u/6073368?v=4)](https://github.com/walkor "walkor (25 commits)")[![don6105](https://avatars.githubusercontent.com/u/9106797?v=4)](https://github.com/don6105 "don6105 (2 commits)")[![keppelcao](https://avatars.githubusercontent.com/u/1754641?v=4)](https://github.com/keppelcao "keppelcao (1 commits)")[![liuquanhao](https://avatars.githubusercontent.com/u/7736182?v=4)](https://github.com/liuquanhao "liuquanhao (1 commits)")[![yuandalu](https://avatars.githubusercontent.com/u/3860040?v=4)](https://github.com/yuandalu "yuandalu (1 commits)")[![KrasilnikovKB](https://avatars.githubusercontent.com/u/16627494?v=4)](https://github.com/KrasilnikovKB "KrasilnikovKB (1 commits)")[![jichangfeng](https://avatars.githubusercontent.com/u/34360195?v=4)](https://github.com/jichangfeng "jichangfeng (1 commits)")

---

Tags

mysqlpdopdo\_mysql

### Embed Badge

![Health badge](/badges/jichangfeng-mysql/health.svg)

```
[![Health](https://phpackages.com/badges/jichangfeng-mysql/health.svg)](https://phpackages.com/packages/jichangfeng-mysql)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.5M69](/packages/ifsnop-mysqldump-php)[nette/database

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5656.7M234](/packages/nette-database)[dibi/dibi

Dibi is Database Abstraction Library for PHP

5013.8M120](/packages/dibi-dibi)[aura/sql

A PDO extension that provides lazy connections, array quoting, query profiling, value binding, and convenience methods for common fetch styles. Because it extends PDO, existing code that uses PDO can use this without any changes to the existing code.

5632.5M43](/packages/aura-sql)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4572.9M34](/packages/aura-sqlquery)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
