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

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

soleon/sc-php
=============

SocketCluster - PHP library for interacting with the SocketCluster.io

v1.0.2(9y ago)1531.8k↓40.5%4[1 issues](https://github.com/soleon-leiloes/sc-php/issues)[1 PRs](https://github.com/soleon-leiloes/sc-php/pulls)MITPHPPHP &gt;=5.5.9

Since Jul 8Pushed 4y ago2 watchersCompare

[ Source](https://github.com/soleon-leiloes/sc-php)[ Packagist](https://packagist.org/packages/soleon/sc-php)[ Docs](https://github.com/soleon-leiloes/sc-php)[ RSS](/packages/soleon-sc-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

SocketCluster - PHP
===================

[](#socketcluster---php)

[![Build Status](https://camo.githubusercontent.com/0bd91b8f93192014dbb7d3d05f9c4b4db9de834b55fc5a5c1a8be6fae7dca623/68747470733a2f2f7472617669732d63692e6f72672f736f6c656f6e2d6c65696c6f65732f73632d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/soleon-leiloes/sc-php)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/074fff33bcf067fa5466d8f97742f08e08760f71358b06a52c44d5fc0dd745ec/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736f6c656f6e2d6c65696c6f65732f73632d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/soleon-leiloes/sc-php/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/fb0b748c0b0890773cf40bec26216a5b2542e3d780d4a4ad2af6ddaaa29538c7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736f6c656f6e2d6c65696c6f65732f73632d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/soleon-leiloes/sc-php/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/836b2b41fda8eb06b0f626a81d0a70853216cf1df053de58dfb30fdbcadc7851/68747470733a2f2f706f7365722e707567782e6f72672f736f6c656f6e2f73632d7068702f762f737461626c65)](https://packagist.org/packages/soleon/sc-php)[![License](https://camo.githubusercontent.com/ab4653f05df74b7aca6af3e6aaab2af9fad3a924ca553e86143a70244cbacffd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736f6c656f6e2f73632d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/soleon/sc-php)

PHP library for interacting with the SocketCluster.io
-----------------------------------------------------

[](#php-library-for-interacting-with-the-socketclusterio)

It's an unofficial client php for [SocketCluster](http://socketcluster.io/) (Is an open source realtime WebSocket framework for Node.js from [socketcluster.io](http://www.socketcluster.io) for PHP 5.5.9+).

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage Basic](#usage-basic)
- [Integrations](#integrations)
    - [Laravel](#laravel-framework)
    - [Pimple (eg:Silex, Slim)](#pimple)
- [Contribution](#contribution)
- [License](#license)

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

[](#installation)

You can install this [package](https://packagist.org/packages/soleon/sc-php) by simply run this composer command:

```
composer require soleon/sc-php

```

Usage Basic
-----------

[](#usage-basic)

```
$optionsOrUri = 'wss://localhost:443/socketcluster/?servicekey=abc'

OR

$optionsOrUri = [
  'secure' => true,
  'host' => 'localhost',
  'port' => '443',
  'path' => '/socketcluster/',
  'query' => [
    'servicekey' => 'abc'
  ],
];

$websocket = \SocketCluster\WebSocket::factory($optionsOrUri);
$socket = new \SocketCluster\SocketCluster($websocket);

// Event Emit
$data = ['message' => 'FooBar'];
$socket->publish('CHANNEL_NAME', $data);
```

Integrations
------------

[](#integrations)

### Laravel Framework

[](#laravel-framework)

Then, add this service provider in your providers array `[app/config/app.php]`:

```
SocketCluster\Providers\LaravelServiceProvider::class,
```

Then, add this Facade to your aliases array `[app/config/app.php]`:

```
'SocketCluster' => SocketCluster\Laravel\SCFacade::class
```

Next you have to copy the configuration to your `connections` array `[app/config/broadcasting.php]`:

```
/*
 * Set default broadcasting driver to socketcluster
 */
'default' => env('BROADCAST_DRIVER', 'socketcluster'),

'socketcluster' => [
    'driver' => 'socketcluster',
    'options' => [
      'secure' => true,
      'host' => 'localhost',
      'port' => '443',
      'path' => '/socketcluster/',
      'query' => [],
    ],
]
```

**Usage Laravel**

- With Facade

```
SocketCluster::publish('ChannelName', ['message' => 'Test publish!!']);
```

With Event Listener

Add a custom broadcast event to your application example `[app/events/PublishToSocketClusterEvent.php]`:

```
namespace App\Events;

use App\Events\Event;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class PublishToSocketClusterEvent implements ShouldBroadcast
{
    use SerializesModels

    /**
     * Content Message
     * @var string
     */
    public $message;

    /**
     * Construct Event
     * @param string $message
     */
    public function __construct($message)
    {
        $this->message = $message;
    }

    /**
     * Get the channels the event should broadcast on.
     * @return array
     */
    public function broadcastOn()
    {
        return ['channelName'];
    }

    /**
     * Get the data to send.
     * @return array
     */
    public function broadcastWith()
    {
      return [
        'message' => $this->message
      ]
    }
}
```

Now to publish in your application simply fire the event:

```
event(new App\Events\PublishToSocketClusterEvent('Test publish!!'));
```

### Pimple

[](#pimple)

[Pimple](http://pimple.sensiolabs.org/) is a simple PHP Dependency Injection Container

Examples of frameworks that use: [Silex](http://silex.sensiolabs.org/), [Slim](http://www.slimframework.com/)

Registering this service provider

```
$app->register(new SocketCluster\Providers\PimpleServiceProvider(), array(
    'socketcluster.options' => array(
      'secure' => true,
      'host' => 'localhost',
      'port' => '443',
      'path' => '/socketcluster/',
      'query' => [],
    )
));
```

**Usage Pimple**

```
$app['socketcluster']->publish('CHANNEL_NAME', $data);
```

Contribution
------------

[](#contribution)

Support follows PSR-2 and PSR-4 PHP coding standards, and semantic versioning. Fork this project and make a pull request!

License
-------

[](#license)

This project is free software distributed under the terms of the [MIT License](http://opensource.org/licenses/mit-license.php).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

3582d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.4

v1.0.1PHP &gt;=5.5.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/16707d7db060ffd57d72072e04d4bae96f85b7efc0605b60364bc1cab1633ed4?d=identicon)[moura137](/maintainers/moura137)

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

---

Top Contributors

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

---

Tags

phplaravelrealtimeBroadcastingsocketcluster

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[basement-chat/basement-chat

Add a real-time chat widget to your Laravel application.

4983.9k](/packages/basement-chat-basement-chat)[salmanzafar/laravel-mqtt

A simple Laravel Library to connect/publish/subscribe to MQTT broker

106153.1k1](/packages/salmanzafar-laravel-mqtt)[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)[rootsoft/laravel-ipfs

Laravel package to communicate with IPFS

323.9k](/packages/rootsoft-laravel-ipfs)

PHPackages © 2026

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