rockstarcode / Streamline by rockstarcode

A free, open alternative for realtime applications
Package Data
Maintainer Username: rockstarcode
Maintainer Contact: (Rulian Estivalletti)
Package Create Date: 2016-09-30
Package Last Update: 2016-09-30
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2022-08-07 15:01:07
Package Statistics
Total Downloads: 19
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 7
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Build Status

RockstarCode StreamLine (previously 82rules/streamline)

A simple alternative to 3rd party push services and realtime libraries.


* PHP ^5.6
* Redis
* Apache/Nginx


This PHP libraries adds a simple interface to create realtime apps using Redis Pub/Sub as the distribution engine.

It allows for User -> Users and Server -> User(s) communication streams Allowing features such as

* Message Notifications
* Chat
* Status Notifications
* Dynamic Content Push
* Dead simple integration
* Long Polling Javascript included
* Auto reconnects on dropped connections
* No need for external services

Quick Start

Better details found on the Wiki

composer require rockstarcode/streamline


use RockstarCode\Streamline\Subscribe;
$sub = new Subscribe($_GET['channel]);

// [POST]
use RockstarCode\Streamline\Publish;
$pub = new Publish($_GET['channel]);

    <script src=""></script>

         window.onload = function(){
             window.StreamLine.subscribe("", function(data){
                    // var data = JSON.parse(json); if data was json
                    document.getElementById("chat").innerHTML += data;
        function sendMessage(event, item){
            if (event.keyCode == 13) {
                var data = [];
                item.value = '';
    <input type="text" style="width:100%" placeholder="Send Message [press enter]" onkeyup="sendMessage(event, this)">
    <p>Messages: </p>
    <div id="chat"></div>


// routes file

    use RockstarCode\StreamLine\Subscribe;

    $subscribe = new Subscribe($channel, function(){
        /// optional custom connection

        $client = new Redis();
        return $client;

        /// function that handles each message as it's received in the channel
        echo json_encode(['status'=>true,'message'=>$message]);

Route::post('/subscribe/{channel}',function($channel, Request $request){
    use RockstarCode\StreamLine\Publish;

    $pub = new Publish($channel);


Included Example

Included in this repo you will find a very simple chat example in ./example

        - .htaccess
        - frontend.php
        - index.php

The example expects for you to use apache or nginx and configure a virtualhost with a documentroot pointed to the examples path

    <VirtualHost *:80>
            ServerName (or whichever domain you choose)
            DocumentRoot /path/to/streamline/example

simply navigate to http:/// on two different browser tabs, you should be able to enter a name in each tab and send messages between each window.

Common Issues

Blocking Requests

If you are using Laravel's Valet, or PHP's built in web server, they do not handle concurrent connections well and block open streams. The only way to test this app is using a web server capable of threading PHP executions.


This is an ongoing project, I welcome feedback and contribution. If you have any questions feel free to email me at