PHPackages                             eole/sandstone - 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. eole/sandstone

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

eole/sandstone
==============

Silex RestApi with Websockets.

2.1.0(8y ago)1115.2k21[2 issues](https://github.com/eole-io/sandstone/issues)1MITPHPPHP &gt;=5.6

Since Jun 17Pushed 7y ago13 watchersCompare

[ Source](https://github.com/eole-io/sandstone)[ Packagist](https://packagist.org/packages/eole/sandstone)[ Docs](https://eole-io.github.io/sandstone/)[ RSS](/packages/eole-sandstone/feed)WikiDiscussions dev Synced 2mo ago

READMEChangelog (10)Dependencies (19)Versions (26)Used By (1)

Sandstone
=========

[](#sandstone)

[![Build Status](https://camo.githubusercontent.com/ffd9746a2cc6e78761e9396979db982a03174374ad68c2887c28fb895bb399de/68747470733a2f2f7472617669732d63692e6f72672f656f6c652d696f2f73616e6473746f6e652e7376673f6272616e63683d646576)](https://travis-ci.org/eole-io/sandstone)[![Latest Stable Version](https://camo.githubusercontent.com/ed445a1f5819f606c789e2a11bcc5c43707f1bf348235d80a802787186c4cbcd/68747470733a2f2f706f7365722e707567782e6f72672f656f6c652f73616e6473746f6e652f762f737461626c65)](https://packagist.org/packages/eole/sandstone)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e203de71dd0845faec71cd9f1ff03061693bbe22286b891ba40d505c0a2463b9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656f6c652d696f2f73616e6473746f6e652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/eole-io/sandstone/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/ca6f2f0b8c77c0e71c05638ed9e21dc5668af864c84199a3712e85f9b17a5be1/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39313463376438662d613531612d343134362d623231312d3434626366383166356234382f6d696e692e706e67)](https://insight.sensiolabs.com/projects/914c7d8f-a51a-4146-b211-44bcf81f5b48)[![License](https://camo.githubusercontent.com/4c5a173acf9077e0950f7b2a92b14de227be66b7e86871cf0cd6c75bf62926f4/68747470733a2f2f706f7365722e707567782e6f72672f656f6c652f73616e6473746f6e652f6c6963656e7365)](https://packagist.org/packages/eole/sandstone)

PHP microframework designed to build a RestApi working together with a **websocket server**.

Build a real time RestApi!

### 💬 New (18 April 2018)

[](#speech_balloon-new-18-april-2018)

I opened a chat channel where you can get help, give feedback, and talk about Sandstone (Mattermost instance):

💬  💬

Install
-------

[](#install)

```
composer require eole/sandstone
```

Usage
-----

[](#usage)

### Create a Sandstone application

[](#create-a-sandstone-application)

Sandstone is a Silex application with websockets:

```
$app = new Eole\Sandstone\Application();
```

### Declare a websocket topic

[](#declare-a-websocket-topic)

Similar as declaring a Silex route:

```
$app->topic('chat/{channel}', function ($topicPattern, $arguments) {
    $channelName = $arguments['channel'];

    return new ChatTopic($topicPattern, $channelName);
});
```

See [ChatTopic class here](https://eole-io.github.io/sandstone-doc/examples/multichannel-chat).

### Send push notifications

[](#send-push-notifications)

When an endpoint is called on the RestApi, i.e `POST /api/articles` and update a resource, you can send a push notification to notify this update.

On the RestApi stack:

```
use Symfony\Component\HttpFoundation\Response;

$app->post('api/articles', function () use ($app) {
    // Dispatch an event on article creation
    $app['dispatcher']->dispatch('article.created', new ArticleEvent());

    return new Response([], 201);
});

// Send all 'article.created' events to push server
$app->forwardEventToPushServer('article.created');
```

Then on the websocket stack:

```
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Eole\Sandstone\Websocket\Topic;

class MyWebsocketTopic extends Topic implements EventSubscriberInterface
{
    public static function getSubscribedEvents()
    {
        return [
            'article.created' => 'onArticleCreated',
        ];
    }

    public function onArticleCreated(ArticleEvent $event)
    {
        $this->broadcast([
            'message' => 'An article has just been published: '.$event->title,
        ]);
    }
}
```

Examples
--------

[](#examples)

Working examples from scratch:

- [RestApi + Websocket + push notification](https://eole-io.github.io/sandstone-doc/examples/full)
- [Authentication on RestApi and Websockets](https://eole-io.github.io/sandstone-doc/authentication)
- [Chat example](https://eole-io.github.io/sandstone-doc/examples/multichannel-chat)

Documentation
-------------

[](#documentation)

[See the full documentation here](https://eole-io.github.io/sandstone-doc/)

[![Sandstone documentation](sandstone-documentation.png)](https://eole-io.github.io/sandstone-doc/)

Sandstone edition
-----------------

[](#sandstone-edition)

You're planning to start a new real-time Rest Api application based on Sandstone?

You may be interested by Sandstone edition.

It already integrates a Sandstone application with a docker environment, a database, debug tools...

[Get started with Sandstone edition](https://eole-io.github.io/sandstone-doc/edition/get-started).

Misc
----

[](#misc)

Articles about Sandstone:

- [Sandstone explained to NodeJS, Python or PHP users](https://alcalyn.github.io/sandstone-explained-nodejs-python-php-users/)
- [Creating a poker planning application with PHP and websockets](https://alcalyn.github.io/poker-planning-php-websockets/)
- [What is Sandstone, What can I do with Sandstone](https://alcalyn.github.io/projects/sandstone/)

Big picture:

Changelog
---------

[](#changelog)

See [Releases page](https://github.com/eole-io/sandstone/releases).

License
-------

[](#license)

This library is under [MIT License](LICENSE).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity68

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

Recently: every ~58 days

Total

23

Last Release

2944d ago

Major Versions

1.3.1 → 2.0.02017-10-25

PHP version history (2 changes)1.0.0PHP &gt;=5.5

2.0.0PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/17f0c4d65197a7aed6ecc8fdedd5a097c7238c9be19aca08c92c05d38fd8c29e?d=identicon)[alcalyn](/maintainers/alcalyn)

---

Top Contributors

[![alcalyn](https://avatars.githubusercontent.com/u/1588144?v=4)](https://github.com/alcalyn "alcalyn (105 commits)")

---

Tags

github-evacueereal-timerealtimerestapiwebsocketwebsocket-serverwebsocketsphpsymfonypushreactphpwebsocketsilex

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/eole-sandstone/health.svg)

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

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M233](/packages/nelmio-api-doc-bundle)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)

PHPackages © 2026

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