PHPackages                             gockets-project/gockets-php - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. gockets-project/gockets-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

gockets-project/gockets-php
===========================

PHP client for Gockets https://github.com/gockets-project/gockets

0.2.0(7y ago)041[2 PRs](https://github.com/gockets-project/gockets-php/pulls)MITPHPPHP &gt;=7.2

Since Apr 30Pushed 3y agoCompare

[ Source](https://github.com/gockets-project/gockets-php)[ Packagist](https://packagist.org/packages/gockets-project/gockets-php)[ RSS](/packages/gockets-project-gockets-php/feed)WikiDiscussions master Synced 3d ago

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

Gockets
=======

[](#gockets)

[![Latest Stable Version](https://camo.githubusercontent.com/7007c1c1a5d2462087e23294db12174c54b38f64f693bdfc51c3be14d48767e9/68747470733a2f2f706f7365722e707567782e6f72672f676f636b6574732d70726f6a6563742f676f636b6574732d7068702f762f737461626c65)](https://packagist.org/packages/gockets-project/gockets-php)[![Build Status](https://camo.githubusercontent.com/52136aa8b8c8867558784da2d0b2f270d14f0e378c28a6d7924fbdbac7eead4a/68747470733a2f2f7472617669732d63692e6f72672f676f636b6574732d70726f6a6563742f676f636b6574732d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gockets-project/gockets-php)[![Coverage Status](https://camo.githubusercontent.com/1648b0866f310d75216560be23e993d60ffba289ba4a8fb22ba954af9d9695dd/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f676f636b6574732d70726f6a6563742f676f636b6574732d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/gockets-project/gockets-php?branch=master)[![Code Quality](https://camo.githubusercontent.com/9ab3eb09cbe40eb7ab5a3dcb1b0d4fb81dd77a7ccf51f4c242185984b3baffb2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676f636b6574732d70726f6a6563742f676f636b6574732d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gockets-project/gockets-php/?branch=master)[![StyleCI](https://camo.githubusercontent.com/008ea47c77ce6a77dbca6d2bd1c175c0839c809f902314c5ba2fb49b9ceaf3ab/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3138343237323234312f736869656c643f6272616e63683d6d6173746572267374796c653d666c6174)](https://github.styleci.io/repos/184272241)

[**Gockets**](https://github.com/gockets-project/gockets#gockets) is daemon written in Golang to give languages, like PHP a middleware for REST-oriented communication with Websockets.

Gockets PHP
===========

[](#gockets-php)

This library provides implemented and ready to use interface for gockets daemon.

Installation via Composer
-------------------------

[](#installation-via-composer)

`composer require gockets-project/gockets-php`

Quickstart
----------

[](#quickstart)

#### Setup Gockets server

[](#setup-gockets-server)

[Gockets page](https://github.com/gockets-project/gockets)

#### Setup PHP client

[](#setup-php-client)

```
use Gockets\Client;
use Gockets\Model\Params;

$host = 'localhost'; // Default value
$port = '8844'; // Default value

$client = new Client(new Params($host, $port));
```

#### Prepare channel

[](#prepare-channel)

Creates new channel. Can accept optional argument instance of `Gockets\Model\ChannelOptions`.

```
use Gockets\Model\ChannelOptions;

$options = new ChannelOptions('http://localhost/hook.php', 'tag');

// Using $client from previous sample

$channel = $client->prepare($options);
```

`Gockets\Model\Сhannel` example:

```
object(Gockets\Model\Channel) {
  ["publisherToken":private] => string(32) "f177965656399535ea241a3da40dfcbf"
  ["subscriberToken":private] => string(32) "90b09a2e2d43c83ed907854a46c710fd"
  ["hookUrl":private] => string(25) "http://localhost/hook.php"
  ["tag":private] => string(3) "tag"
  ["listeners":private] => int(0)
}
```

#### Show channel

[](#show-channel)

Returns specific channel.

```
$publisherToken = '95e9aca9575c29ca8cdc92e54767d783';

$channel = $client->show($publisherToken);
```

#### Show all channels

[](#show-all-channels)

Returns empty or filled with `Gockets\Model\Сhannel` objects array.

```
$channels = $client->showAll();
```

#### Edit channel

[](#edit-channel)

Use to modify specific channel attributes (change hook url or tag).

```
use Gockets\Model\ChannelOptions;

$options = new ChannelOptions('http://localhost/new_hook.php', 'someApplication|tagged');

$updatedChannel = $client->update($channel->getPublisherToken(), $options);
```

#### Publish data

[](#publish-data)

Send some data to channel. In this example `$channel` variable contains `Gockets\Model\Сhannel` object.

```
$data = [
    'data' => 'content',
];

$response = $client->publish($data, $channel->getPublisherToken());
```

`Gockets\Model\Response $response` example:

```
object(Gockets\Model\Response) {
  ["success":private] => bool(true)
  ["type":private] => string(3) "INF"
  ["message":private] => string(38) "Successfully pushed data to subscriber"
}
```

Always try to ensure that `$success` property of response is `true`.

#### Close channel

[](#close-channel)

Closes connection and removes channel.

```
$response = $client->close($channel->getPublisherToken());

echo $response->getMessage(); // Outputs "Successfully closed connection"
```

#### Error handling

[](#error-handling)

Mostly error handling currently in development, but in case if publisher token was not found library throws `Gockets\Exception\ChannelNotFoundException`.

```
use Gockets\Exception\ChannelNotFoundException;

try {
    $client->show('some-publisher-token');
} catch (ChannelNotFoundException $exception) {
    // Your logic when publisher token was not found
}
```

In `bin` directory located Gockets builded instance for Linux. For more information about Golang project refer to [it's](https://github.com/gockets-project/gockets#gockets) page.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Every ~14 days

Total

2

Last Release

2558d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc2bcc7167755ae8dbb7df74b10910168dd931d1d8cdf759d33ccc4f1f4d1475?d=identicon)[therealartz](/maintainers/therealartz)

---

Top Contributors

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

---

Tags

websocketSocketphp-websocketgockets

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gockets-project-gockets-php/health.svg)

```
[![Health](https://phpackages.com/badges/gockets-project-gockets-php/health.svg)](https://phpackages.com/packages/gockets-project-gockets-php)
```

###  Alternatives

[denis660/laravel-centrifugo

Centrifugo broadcaster for laravel

113164.7k](/packages/denis660-laravel-centrifugo)[warriorxk/phpwebsockets

A websocket library with support for IPC using socket pairs

1225.3k](/packages/warriorxk-phpwebsockets)[sockeon/sockeon

Framework-agnostic PHP WebSocket and HTTP server library with attribute-based routing and support for namespaces and rooms.

291.3k2](/packages/sockeon-sockeon)[facile-it/crossbar-http-publisher-bundle

This bundle allows to submit PubSub events via HTTP/POST requests to a Crossbar HTTP Publisher.

1114.4k](/packages/facile-it-crossbar-http-publisher-bundle)

PHPackages © 2026

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