PHPackages                             tz-lom/hsphp - 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. tz-lom/hsphp

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

tz-lom/hsphp
============

Client library for MySQL HandlerSocket extension.

v1.21(13y ago)10032.4k↓50%28[2 PRs](https://github.com/tz-lom/HSPHP/pulls)MITPHP

Since Jan 11Pushed 10y ago7 watchersCompare

[ Source](https://github.com/tz-lom/HSPHP)[ Packagist](https://packagist.org/packages/tz-lom/hsphp)[ RSS](/packages/tz-lom-hsphp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Master: [![Build Status](https://camo.githubusercontent.com/6623d3c18e2c27b908d58e80024fe5215aafe2ebf1cfd0e404c58b1da5f35b04/68747470733a2f2f6170692e7472617669732d63692e6f72672f747a2d6c6f6d2f48535048502e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/tz-lom/HSPHP)

HandlerSocker Library for PHP
=============================

[](#handlersocker-library-for-php)

This library provides an API for communicating with the HandlerSocket plugin for MySQL compatible databases(MySQL, MariaDB, Percona).

For more information on HandlerSocket, check out the [MariaDB Documentation on HandlerSocket here](https://mariadb.com/kb/en/handlersocket/).

Installation
------------

[](#installation)

[Once you have composer installed](https://getcomposer.org/doc/00-intro.md#system-requirements "Getting Started With Composer"), run the following in your php project directory:

```
    php composer.phar require tz-lom/hsphp --no-update

```

Usage Examples
==============

[](#usage-examples)

Select
------

[](#select)

```
$c = new \HSPHP\ReadSocket();
$c->connect();
$id = $c->getIndexId('data_base_name', 'table_name', '', 'id,name,some,thing,more');
$c->select($id, '=', array(42)); // SELECT WITH PRIMARY KEY
$response = $c->readResponse();

//SELECT with IN statement
$c = new \HSPHP\ReadSocket();
$c->connect();
$id = $c->getIndexId('data_base_name', 'table_name', '', 'id,name,some,thing,more');
$c->select($id, '=', array(0), 0, 0, array(1,42,3));
$response = $c->readResponse();
```

Update
------

[](#update)

```
$c = new \HSPHP\WriteSocket();
$c->connect('localhost',9999);
$id = $c->getIndexId('data_base_name','table_name','','k,v');
$c->update($id,'=',array(100500),array(100500,42)); // Update row(k,v) with id 100500 to  k = 100500, v = 42
$response = $c->readResponse(); // Has 1 if OK
```

Batch update
------------

[](#batch-update)

```
$c = new \HSPHP\WriteSocket();
$c->connect('localhost',9999);
$id = $c->getIndexId('data_base_name','table_name','','k,v');
$c->update($id,'=',array(100500),array(100500,42), 2, 0, array(100501, 100502)); // Update rows where k IN (100501, 100502)
$response = $c->readResponse(); // Has 1 if OK
```

Delete
------

[](#delete)

```
$c = new \HSPHP\WriteSocket();
$c->connect('localhost',9999);
$id = $c->getIndexId('data_base_name','table_name','','k,v');
$c->delete($id,'=',array(100500));
$response = $c->readResponse(); //return 1 if OK
```

Insert
------

[](#insert)

```
$c = new \HSPHP\WriteSocket();
$c->connect('localhost',9999);
$id = $c->getIndexId('data_base_name','table_name','','k,v');
$c->insert($id,array(100500,'test\nvalue'));
$response = $c->readResponse(); //return array() if OK
```

Increment
---------

[](#increment)

```
$c = new \HSPHP\WriteSocket();
$c->connect('localhost',9999);
$id = $c->getIndexId('data_base_name','table_name','','v');
$c->increment($id,'=',array(100500),array(2)); // Increment v column by 2
$response = $c->readResponse(); // Has 1 if OK
```

Decrement
---------

[](#decrement)

```
$c = new \HSPHP\WriteSocket();
$c->connect('localhost',9999);
$id = $c->getIndexId('data_base_name','table_name','','v');
$c->decrement($id,'=',array(100500),array(2)); // Decrement v column by 2
$response = $c->readResponse(); // Has 1 if OK
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~4 days

Total

3

Last Release

4866d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/296704e8936395ad945a9dd5ee75700a4cca913bfe084b07fd938c5bb2b31651?d=identicon)[tz-lom](/maintainers/tz-lom)

---

Top Contributors

[![tz-lom](https://avatars.githubusercontent.com/u/454282?v=4)](https://github.com/tz-lom "tz-lom (11 commits)")[![Andrewpk](https://avatars.githubusercontent.com/u/1033728?v=4)](https://github.com/Andrewpk "Andrewpk (10 commits)")[![MorbidAngel](https://avatars.githubusercontent.com/u/2316426?v=4)](https://github.com/MorbidAngel "MorbidAngel (6 commits)")[![KonstantinKuklin](https://avatars.githubusercontent.com/u/573586?v=4)](https://github.com/KonstantinKuklin "KonstantinKuklin (4 commits)")[![yudina-m](https://avatars.githubusercontent.com/u/767836?v=4)](https://github.com/yudina-m "yudina-m (3 commits)")[![yvasiyarov](https://avatars.githubusercontent.com/u/889406?v=4)](https://github.com/yvasiyarov "yvasiyarov (1 commits)")[![pdeszynski](https://avatars.githubusercontent.com/u/1628168?v=4)](https://github.com/pdeszynski "pdeszynski (1 commits)")[![simi](https://avatars.githubusercontent.com/u/193936?v=4)](https://github.com/simi "simi (1 commits)")[![ajdonnison](https://avatars.githubusercontent.com/u/84363?v=4)](https://github.com/ajdonnison "ajdonnison (1 commits)")

---

Tags

mysqlhandler socket

### Embed Badge

![Health badge](/badges/tz-lom-hsphp/health.svg)

```
[![Health](https://phpackages.com/badges/tz-lom-hsphp/health.svg)](https://phpackages.com/packages/tz-lom-hsphp)
```

###  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)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k25.2M34](/packages/kirschbaum-development-eloquent-power-joins)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58723.9M36](/packages/scienta-doctrine-json-functions)[cytopia/mysqldump-secure

Secure mysqldump script with encryption, compression, logging, blacklisting and Nagios monitoring integration

1474.7k1](/packages/cytopia-mysqldump-secure)

PHPackages © 2026

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