PHPackages                             lowerpower/bolt - 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. lowerpower/bolt

ActiveLibrary

lowerpower/bolt
===============

Asynchronous WebSocket client built on ReactPHP

0.2.0(8y ago)018MITPHP

Since Oct 16Pushed 8y ago1 watchersCompare

[ Source](https://github.com/lowerpower/bolt)[ Packagist](https://packagist.org/packages/lowerpower/bolt)[ RSS](/packages/lowerpower-bolt/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (10)Versions (7)Used By (0)

bolt
====

[](#bolt)

Asynchronous WebSocket client client library for PHP. Supports HyBi, as well as Hixie #76 (no point).

This was built purely to be a client, as the majority of the WS clients available also contain servers and are very bloated.

This is not the original version, this has been updated to use latest reactphp and the API has been modified to be more consistant with modern reactphp.

Installation
============

[](#installation)

Using composer:

```
"require": {
    "lowerpower/bolt": "^0.2"
}

```

Usage
=====

[](#usage)

Since this really lends itself to being an asynchronous app, it is built to use the React event loops and resolver since there's a good chance they'll be in your project already and this lets you attach to the same loop.

```
$loop = \React\EventLoop\Factory::create();

// other options like tls, socket, etc are possible see "React\Socket\Connector"
$options=$options=array(
    'timeout'=>5.0                      /* 'timeout'=> false for disable */
);

// Now workes exaction like "React\Socket\Connector"
$client = new \Calcinai\Bolt\Client($loop, $options);

//Most WS servers will complain/forbid if there is no origin header
$client->setOrigin('127.0.0.1');

// new, URL is here, ws:// and wss:// supported
$client->connect('ws://127.0.0.1:1337/chat');

$client->on('stateChange', function($newState){
    echo "State changed to: $newState\n";
});

$client->on('message', function($message) use ($client){
    echo "New message: \n";
    echo $message;

    $client->send('This is a response message');
});

$loop->run();
```

Other available events are `connecting`, `connect`, `closing`, `close`

HTTP basic auth is also supported via the URI inf the form `user:pass@host`

Any feedback is most welcome

###  Health Score

25

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.3% 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 ~147 days

Recently: every ~183 days

Total

6

Last Release

3075d ago

### Community

Maintainers

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

---

Top Contributors

[![lowerpower](https://avatars.githubusercontent.com/u/7493281?v=4)](https://github.com/lowerpower "lowerpower (18 commits)")[![calcinai](https://avatars.githubusercontent.com/u/2415868?v=4)](https://github.com/calcinai "calcinai (14 commits)")

### Embed Badge

![Health badge](/badges/lowerpower-bolt/health.svg)

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

###  Alternatives

[react/react

ReactPHP: Event-driven, non-blocking I/O with PHP.

9.1k3.5M57](/packages/react-react)[php-pm/php-pm

PHP-PM is a process manager, supercharger and load balancer for PHP applications.

6.6k439.0k7](/packages/php-pm-php-pm)[web3p/web3.php

Ethereum web3 interface.

1.3k313.7k37](/packages/web3p-web3php)[clue/redis-react

Async Redis client implementation, built on top of ReactPHP.

2829.2M38](/packages/clue-redis-react)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k366.4k20](/packages/team-reflex-discord-php)[react/mysql

Async MySQL database client for ReactPHP.

340410.7k24](/packages/react-mysql)

PHPackages © 2026

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