PHPackages                             socketbus/socketbus-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. socketbus/socketbus-php

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

socketbus/socketbus-php
=======================

v1.0.1(5y ago)0361PHPPHP &gt;=5.3.0

Since Jan 6Pushed 5y agoCompare

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

READMEChangelogDependencies (3)Versions (3)Used By (1)

SocketBus PHP Library
=====================

[](#socketbus-php-library)

The SocketBus PHP Library

#### Getting Started

[](#getting-started)

1. **Create an account** -
2. **Minimum requirements** -
3. **Install the library** - ```
    composer require socketbus/socketbus-php
    ```
4. **Using the library** -

Create a SocketBus instance
---------------------------

[](#create-a-socketbus-instance)

```
require 'vendor/autoload.php';

use SocketBus\SocketBus;

$config = [
    'app_id' => 's-1-J2PCu8g8sAejZeXx',
    'secret' => 'cdKBpcruwYQ96kvIaYiorbTFxRDCbVfj'
];

$socketBus = new SocketBus($config);
```

###### End-to-End Encryption

[](#end-to-end-encryption)

To ensure that your data is secure, you can enable End-to-end encryption under Application &gt; Settings. This setting in combination with the option `custom_encryption_key` encrypts the payload and decrypts in the client when an authenticated user receives a encrypted payload.

```
$config = [
    'app_id' => 's-1-J2PCu8g8sAejZeXx',
    'secret' => 'cdKBpcruwYQ96kvIaYiorbTFxRDCbVfj',
    'custom_encryption_key' => 'my-unique-key'
];
```

Authentication
--------------

[](#authentication)

##### Defining the channel type

[](#defining-the-channel-type)

```
$channelName = $request->channel_name;

if ($socketBus->isChannelPrivate($channelName)) {
    // The channel is private
}
if ($socketBus->isChannelPresence($channelName)) {
    // The channel is presence
}
if ($socketBus->isChannelPublic($channelName)) {
    // The channel is public
}
```

##### Private Authentication

[](#private-authentication)

```
$socketId = $request->socket_id;
$channelName = $request->channel_name;

if (/** verifies if user can access the request channel */) {
    // returns the token to the client
    return [
        'auth' => $socketbus->auth($socketId, $channelName)
    ];
}
```

##### Presence Authentication

[](#presence-authentication)

```
$socketId = $request->socket_id;
$channelName = $request->channel_name;
$userId = /** gets the current user id */;

if (/** verifies if user can access the request channel */) {
    // returns the data
    return $socketbus->authPresence($socketId, $channelName, $userId, true);
}
```

Broadcasting
------------

[](#broadcasting)

```
$payload = [
    'type' => 'cupcake',
    'flavor' => 'sweet'
];

$sockebus->broadcast('food-observer', 'new-food', $payload);
```

Resources
---------

[](#resources)

[API Docs](https://socketbus.com/docs) - Check-out the full documentation

Related Projects
----------------

[](#related-projects)

[SocketBus Laravel Library](https://github.com/SocketBus/socketbus-laravel) - Laravel library

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

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

Total

2

Last Release

2004d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1234758?v=4)[valterlorran](/maintainers/valterlorran)[@valterlorran](https://github.com/valterlorran)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[guzzlehttp/guzzle-services

Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.

25711.0M191](/packages/guzzlehttp-guzzle-services)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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