PHPackages                             codenix-sv/bitfinex-api-ws - 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. codenix-sv/bitfinex-api-ws

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

codenix-sv/bitfinex-api-ws
==========================

PHP WebSocket client PHP for the Bitfinex API

7181PHP

Since Dec 1Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/codenix-sv/bitfinex-api-ws)[ Packagist](https://packagist.org/packages/codenix-sv/bitfinex-api-ws)[ RSS](/packages/codenix-sv-bitfinex-api-ws/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

This repository is no longer active.
====================================

[](#this-repository-is-no-longer-active)

⛔ No new issues ⛔ No pull requests ⛔ No maintenance

Source code is kept only for reference purposes.

bitfinex-api-ws
===============

[](#bitfinex-api-ws)

[![Build Status](https://camo.githubusercontent.com/3156a1d9f95f99b26ee41af644042b409e2fa452f70c89aca494d7787d2c028d/68747470733a2f2f7472617669732d63692e636f6d2f636f64656e69782d73762f62697466696e65782d6170692d77732e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/codenix-sv/bitfinex-api-ws)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/804b64c84537dabb5793ec5452405eda94099373212addef77ceea31eb63d0c0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f64656e69782d73762f62697466696e65782d6170692d77732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/codenix-sv/bitfinex-api-ws/?branch=master)[![Test Coverage](https://camo.githubusercontent.com/33963093cdcee827ba0ad49446393314a25edad60d4438f41c8185db3f87660b/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f33623134333732623031346162333762643834382f746573745f636f766572616765)](https://codeclimate.com/github/codenix-sv/bitfinex-api-ws/test_coverage)[![Maintainability](https://camo.githubusercontent.com/b6f037a7db45568f681d73b82cc956cb144b7f8a97abd7eedd564ca2f58d0ffe/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f33623134333732623031346162333762643834382f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/codenix-sv/bitfinex-api-ws/maintainability)[![License: MIT](https://camo.githubusercontent.com/22203a0d9dc60047dcfc59475062a60bdf50d1e555d11726edcd5307b988592e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f64656e69782d73762f62697466696e65782d6170692d7773)](https://github.com/codenix-sv/bitfinex-api-ws/blob/master/LICENSE)

WebSocket client, written with PHP for [bitfinex.com](https://www.bitfinex.com) API.

Bitfinex is a full-featured spot trading platform for major digital assets &amp; cryptocurrencies, including Bitcoin, Ethereum, EOS, Litecoin, Ripple, NEO, Monero and many more. Bitfinex offers leveraged margin trading through a peer-to-peer funding market, allowing users to securely trade with up to 3.3x leverage.

For additional information about API visit [docs.bitfinex.com/docs/ws-general](https://docs.bitfinex.com/docs/ws-general)

Requirements
------------

[](#requirements)

- PHP &gt;= 7.3
- ext-json

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require codenix-sv/bitfinex-api-ws
```

or add

```
"codenix-sv/bitfinex-api-ws": "^0.1"
```

Basic usage
-----------

[](#basic-usage)

### Example

[](#example)

```
use Codenixsv\BitfinexWs\BitfinexClient;
use Codenixsv\BitfinexWs\WsClient;
use Codenixsv\BitfinexWs\Request\SubscribeTicker;
use Ratchet\RFC6455\Messaging\Message;

$client = new BitfinexClient();

$onMessage = function (Message $message) {
    echo $message->__toString() . PHP_EOL;
};

$onClose = function ($code = null, $reason = null) {
    echo 'WebSocket Connection closed! Code: ' . $code . ' Reason: ' . $reason  . PHP_EOL;
};

$onError = function (\Exception $e) {
    echo 'Error: ' . $e->getMessage() . PHP_EOL;
};

$events =  [
    WsClient::EVENT_MESSAGE => $onMessage,
    WsClient::EVENT_CLOSE => $onClose,
    WsClient::EVENT_ERROR => $onError
];

$client->connect([new SubscribeTicker('tBTCUSD'), new SubscribeTicker('tETHUSD')], $events);
```

Available channels
------------------

[](#available-channels)

### Public

[](#public)

#### [SubscribeTicker](https://docs.bitfinex.com/reference#ws-public-ticker)

[](#subscribeticker)

The ticker endpoint provides a high level overview of the state of the market for a specified pair. It shows the current best bid and ask, the last traded price, as well as information on the daily volume and price movement over the last day.

```
$client->connect([new SubscribeTicker('tBTCUSD')], $events);
```

#### [SubscribeTrades](https://docs.bitfinex.com/reference#ws-public-trades)

[](#subscribetrades)

This channel sends a trade message whenever a trade occurs at Bitfinex. It includes all the pertinent details of the trade, such as price, size and the time of execution. The channel can send funding trade data as well.

```
$client->connect([new SubscribeTrades('tBTCUSD')], $events);
```

#### [SubscribeBooks](https://docs.bitfinex.com/reference#ws-public-books)

[](#subscribebooks)

The Order Books channel allows you to keep track of the state of the Bitfinex order book. It is provided on a price aggregated basis with customizable precision. Upon connecting, you will receive a snapshot of the book followed by updates for any changes to the state of the book.

```
$symbol = 'tBTCUSD';
$precision = 'P1';
$frequency = 'F1';
$length = '100';

$client->connect([new SubscribeBooks($symbol, $precision, $frequency, $length)], $events);
```

#### [SubscribeRawBooks](https://docs.bitfinex.com/reference#ws-public-raw-books)

[](#subscriberawbooks)

The Raw Books channel provides the most granular books.

```
$symbol = 'tBTCUSD';
$length = '100';

$client->connect([new SubscribeRawBooks($symbol, $length)], $events);
```

#### [SubscribeCandles](https://docs.bitfinex.com/reference#ws-public-candles)

[](#subscribecandles)

The Candles endpoint provides OCHL (Open, Close, High, Low) and volume data for the specified trading pair.

```
$client->connect([new SubscribeCandles('trade:1m:tBTCUSD')], $events);
```

#### [SubscribeCandles](https://docs.bitfinex.com/reference#ws-public-status)

[](#subscribecandles-1)

Subscribe to and receive different types of platform information - currently supports derivatives pair status and liquidation feed.

```
$client->connect([new SubscribeStatus('deriv:tBTCF0:USTF0')], $events);
```

License
-------

[](#license)

`codenix-sv/bitfinex-api-ws` is released under the MIT License. See the bundled [LICENSE](./LICENSE) for details.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance45

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d8907d07b122404a37d236411aa11851e36f8693183439572675ffcbddb3fdfe?d=identicon)[codenix-sv](/maintainers/codenix-sv)

---

Top Contributors

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

---

Tags

bitfinex-apibitfinex-api-wswebsocketws

### Embed Badge

![Health badge](/badges/codenix-sv-bitfinex-api-ws/health.svg)

```
[![Health](https://phpackages.com/badges/codenix-sv-bitfinex-api-ws/health.svg)](https://phpackages.com/packages/codenix-sv-bitfinex-api-ws)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M92](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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