Skip to content
This repository has been archived by the owner on May 25, 2020. It is now read-only.

Latest commit

 

History

History
46 lines (31 loc) · 1.39 KB

README.md

File metadata and controls

46 lines (31 loc) · 1.39 KB

NOTE - This repository is no longer maintained

Ratchet Stack

Latest Stable Version Total Downloads License

Builder for ratchet middlewares based on ComponentInterface.

Ratchet Stack Builder is a small library that helps you construct a nested ComponentInterface decorator tree. It models it as a stack of middlewares.

Inspired of StackPHP

Installation

composer require gos/ratchet-stack

Example

use Gos\Component\RatchetStack\Builder;
use React\Socket\Server;
use React\EventLoop\Factory;

$stack = new Builder();
$loop = Factory::create();

$socket = new Server($loop);
$socket->listen($this->port, $this->host);

$stack
	->push('Ratchet\Server\IoServer', $socket, $loop)
	->push('Ratchet\Http\HttpServer')
	->push('Ratchet\WebSocket\WsServer')
	->push('Ratchet\Session\SessionProvider', $this->sessionHandler)
	->push('Ratchet\Wamp\WampServer')
;

$wampApplication = new WampApplication(); //Instance of WampServerInterface

$app = $stack->resolve($wampApplication); //Give IoServer instance
$app->run();