PHPackages                             inpassor/realplexor - 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. inpassor/realplexor

ActiveLibrary

inpassor/realplexor
===================

Realplexor PHP API

0.1.2(9y ago)33171MITPHPPHP &gt;=5.4.0

Since Oct 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Inpassor/realplexor)[ Packagist](https://packagist.org/packages/inpassor/realplexor)[ RSS](/packages/inpassor-realplexor/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

Realplexor PHP API
==================

[](#realplexor-php-api)

[![Latest Stable Version](https://camo.githubusercontent.com/09c84b820e84edf72fec308980e2f656135c64a6d90c54343d892ca26ba9c675/68747470733a2f2f706f7365722e707567782e6f72672f696e706173736f722f7265616c706c65786f722f76657273696f6e)](https://packagist.org/packages/inpassor/realplexor)[![Total Downloads](https://camo.githubusercontent.com/0aa319349024bb204f74268f5f7fe2e83e037edbcdf94780655b07461e8ff4ae/68747470733a2f2f706f7365722e707567782e6f72672f696e706173736f722f7265616c706c65786f722f646f776e6c6f616473)](https://packagist.org/packages/inpassor/realplexor)[![License](https://camo.githubusercontent.com/46d63900d18fc44d333c5209da8839468e3754afca3c636db92d0cdde87912c2/68747470733a2f2f706f7365722e707567782e6f72672f696e706173736f722f7265616c706c65786f722f6c6963656e7365)](https://packagist.org/packages/inpassor/realplexor)

Author: Inpassor

GitHub repository:

This library implements [Dklab\_Realplexor](https://github.com/DmitryKoterov/dklab_realplexor)PHP API.

Dklab\_Realplexor is comet server which handles 1000000+ parallel browser connections.

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

[](#installation)

```
composer require inpassor/realplexor

```

Usage
-----

[](#usage)

Create some class which uses the trait RealplexorAPI:

```
class Realplexor
{
    use \inpassor\realplexor\RealplexorAPI;
    ...
}

```

Create the instance of this class (which uses the trait RealplexorAPI):

```
$realplexor = new Realplexor();
$realplexor->host = '127.0.0.1';
$realplexor->port = 10010;
$realplexor->namespace = 'rpl_';

```

Then use it:

```
$realplexor->send('Alpha',$someData);

```

### Public Properties

[](#public-properties)

PropertyTypeDescriptionhoststringThe server host. Default: '127.0.0.1'portintegerThe connection port. Default: 10010namespacestringNamespace to use. Default: ''loginstringLogin for connection (if the server need it). Default: ''passwordstringPassword for connection (if the server need it). Default: ''timeoutintegerThe connection timeout, in seconds. Default: 5charsetintegerCharset used in Content-Type for JSON and other responses. Default: 'UTF-8'lastErrorstringLast error message, if error occured.### Public methods

[](#public-methods)

MethodDescription[send()](#public-function-sendidsandcursors-data-showonlyforids--null)Send data to Realplexor.[cmdOnlineWithCounters()](#public-function-cmdonlinewithcountersidprefixes--)Return list of online IDs (keys) and number of online browsers for each ID ("online" means "connected just now", it is very approximate).[cmdOnline()](#public-function-cmdonlineidprefixes--)Return list of online IDs.[cmdWatch()](#public-function-cmdwatchfrompos-idprefixes--)Return all Realplexor events (e.g. ID offline/offline changes) happened after $fromPos cursor.### Protected methods

[](#protected-methods)

MethodDescription[\_addNamespace()](#protected-function-_addnamespaceidprefixes)Add the namespace to ID prefixes.[\_cutNamespace()](#protected-function-_cutnamespaceid)Cut off the namespace from ID.[\_sendCmd()](#protected-function-_sendcmdcmd)Send IN command.[\_send()](#protected-function-_sendidentifier-body)Send specified data to IN channel. Return response data.### Method Details

[](#method-details)

#### public function send($idsAndCursors, $data, $showOnlyForIds = null)

[](#public-function-sendidsandcursors-data-showonlyforids--null)

Send data to Realplexor.

ParameterTypeDescription$idsAndCursorsmixedTarget IDs in form of: \[id1 =&gt; cursor1, id2 =&gt; cursor2, ...\] or \[id1, id2, id3, ...\]. If sending to a single ID, you may pass it as a plain string, not array.$datamixedData to be sent (any format, e.g. nested arrays are OK).$showOnlyForIdsarraySend this message to only those who also listen any of these IDs. This parameter may be used to limit the visibility to a closed number of cliens: give each client an unique ID and enumerate client IDs in $showOnlyForIds to not to send messages to others.**return**booleanTrue on success, false on fail. Check $this-&gt;lastError for error message if false returned.#### public function cmdOnlineWithCounters($idPrefixes = \[\])

[](#public-function-cmdonlinewithcountersidprefixes--)

Return list of online IDs (keys) and number of online browsers for each ID ("online" means "connected just now", it is very approximate).

ParameterTypeDescription$idPrefixesstring|arrayIf set, only online IDs with these prefixes are returned.**return**arrayList of matched online IDs (keys) and online counters (values). Check $this-&gt;lastError for error message if empty array returned.#### public function cmdOnline($idPrefixes = \[\])

[](#public-function-cmdonlineidprefixes--)

Return list of online IDs.

ParameterTypeDescription$idPrefixesstring|arrayIf set, only online IDs with these prefixes are returned.**return**arrayList of matched online IDs. Check $this-&gt;lastError for error message if empty array returned.#### public function cmdWatch($fromPos, $idPrefixes = \[\])

[](#public-function-cmdwatchfrompos-idprefixes--)

Return all Realplexor events (e.g. ID offline/offline changes) happened after $fromPos cursor.

ParameterTypeDescription$fromPosstringStart watching from this cursor.$idPrefixesstring|arrayWatch only changes of IDs with these prefixes.**return**arrayList of \["event" =&gt; ..., "cursor" =&gt; ..., "id" =&gt; ...\]. Check $this-&gt;lastError for error message if empty array returned.#### protected function \_addNamespace($idPrefixes)

[](#protected-function-_addnamespaceidprefixes)

Add the namespace to ID prefixes.

ParameterTypeDescription$idPrefixesstring|arrayID prefixes without namespace.**return**stringID prefixes with namespace.#### protected function \_cutNamespace($id)

[](#protected-function-_cutnamespaceid)

Cut off the namespace from ID.

ParameterTypeDescription$idstringID with namespace.**return**stringID without namespace.#### protected function \_sendCmd($cmd)

[](#protected-function-_sendcmdcmd)

Send IN command.

ParameterTypeDescription$cmdstringCommand to send.**return**string|nullServer IN response. Check $this-&gt;lastError for error message if null returned.#### protected function \_send($identifier, $body)

[](#protected-function-_sendidentifier-body)

Send specified data to IN channel. Return response data.

ParameterTypeDescription$identifierstringIf set, pass this identifier string.$bodystringData to be sent.**return**string|nullResponse from IN line. Check $this-&gt;lastError for error message if null returned.Client-side
-----------

[](#client-side)

To implement Realplexor client-side feel free to use bower package [inpassor-jquery-realplexor](https://github.com/Inpassor/jquery-realplexor)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

3494d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f64e4e791a38a96f9d40f19511fce91a8252cdad0eb8968425b710f58d1f490?d=identicon)[Inpassor](/maintainers/Inpassor)

---

Top Contributors

[![Inpassor](https://avatars.githubusercontent.com/u/3442673?v=4)](https://github.com/Inpassor "Inpassor (4 commits)")

---

Tags

longpollingcometrealplexordklab\_realplexor

### Embed Badge

![Health badge](/badges/inpassor-realplexor/health.svg)

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

###  Alternatives

[gotzmann/comet

Modern PHP framework for building blazing fast REST APIs and microservices

68816.2k1](/packages/gotzmann-comet)[nelexa/buffer

Reading And Writing Binary Data (incl. primitive types, ex. byte, ubyte, short, ushort, int, uint, long, float, double). The classes also help with porting the I/O operations of the JAVA code.

33521.7k4](/packages/nelexa-buffer)[ballen/distical

A distance (Lat/Long) calculation library for PHP

40180.2k2](/packages/ballen-distical)[gabrielelana/graceful-death

Library that let you catch fatal errors

568.6k](/packages/gabrielelana-graceful-death)[sarfraznawaz2005/laravel-sse

Laravel package to provide Server Sent Events functionality for your app.

474.6k](/packages/sarfraznawaz2005-laravel-sse)[cometbackup/comet-php-sdk

PHP SDK for the Comet Server API

107.7k](/packages/cometbackup-comet-php-sdk)

PHPackages © 2026

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