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

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

kornrunner/hsphp
================

Client library for MySQL HandlerSocket extension.

v2.0.0(8y ago)28.9kMITPHP

Since Jan 11Pushed 7y ago1 watchersCompare

[ Source](https://github.com/kornrunner/HSPHP)[ Packagist](https://packagist.org/packages/kornrunner/hsphp)[ RSS](/packages/kornrunner-hsphp/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)Dependencies (2)Versions (6)Used By (0)

Master: [![Build Status](https://camo.githubusercontent.com/acccc067b9f8232e00f2d5385f6a6d510a5601a831d804ed2bae8dffa9e2b6f0/68747470733a2f2f7472617669732d63692e6f72672f6b6f726e72756e6e65722f48535048502e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kornrunner/HSPHP) [![Coverage Status](https://camo.githubusercontent.com/99af2fd46f837cbdc135a243b7729e1b1f00e8b50562c1764d5e95001150a556/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6b6f726e72756e6e65722f48535048502f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/kornrunner/HSPHP?branch=master)

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:

```
    composer require kornrunner/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

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity67

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

Total

5

Last Release

3126d ago

Major Versions

v1.22 → v2.0.02017-12-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/725986?v=4)[Boris Momčilović](/maintainers/kornrunner)[@kornrunner](https://github.com/kornrunner)

---

Top Contributors

[![kornrunner](https://avatars.githubusercontent.com/u/725986?v=4)](https://github.com/kornrunner "kornrunner (27 commits)")[![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

handlersocketmariadbmysqlmysqlmariadbnosqlhandler socketHandlerSocketpercona

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[doctrine/dbal

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

9.7k605.0M6.5k](/packages/doctrine-dbal)[catfan/medoo

The lightweight PHP database framework to accelerate development

4.9k1.5M203](/packages/catfan-medoo)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.8M75](/packages/ifsnop-mysqldump-php)[scienta/doctrine-json-functions

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

58825.2M48](/packages/scienta-doctrine-json-functions)[aplus/database

Aplus Framework Database Library

3391.6M7](/packages/aplus-database)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.1k](/packages/clouddueling-mysqldump-php)

PHPackages © 2026

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