2017 © Pedro Peláez
 

library swoole-foundation

Catalyst Swoole Foundation

image

catalyst/swoole-foundation

Catalyst Swoole Foundation

  • Saturday, January 28, 2017
  • by nihylum
  • Repository
  • 3 Watchers
  • 4 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

SwooleFoundation

Swoole Foundation Library, (*1)

What is the Swoole Foundation

The swoole foundation is a factory foundation to easily create swoole server instances. The orchestration of settings and events is closure based., (*2)

Dependencies

This Package depends on catalyst/servant., (*3)

Creating a Swoole Server

use Catalyst\Swoole\{
    ServerFactory,
    Entities\ServerEvents,
    Entities\ServerConfiguration
};

$factory = new ServerFactory();

$server = $factory->server(function(ServerConfiguration $settings, ServerEvents $events) {
    $settings->withBinding('::', 9508);

    $events->onStart(function() {
        echo 'Server started!';
    });
});

Creating a Swoole Http Server

use Catalyst\Swoole\{
    ServerFactory,
    Entities\HttpServerEvents,
    Entities\ServerConfiguration
};

$factory = new ServerFactory();

$server = $factory->httpServer(function(ServerConfiguration $settings, HttpServerEvents $events) {
    $settings->withBinding('::', 80);

    $events->onRequest(function(swoole_http_request $request, swoole_http_respose $response) {
        $response->end('Hello World!');
    });
});

Creating a Swoole Websocket Server

use Catalyst\Swoole\{
    ServerFactory,
    Entities\HttpServerEvents,
    Entities\ServerConfiguration
};

$factory = new ServerFactory();

$server = $factory->webSocketServer(function(ServerConfiguration $settings, HttpServerEvents $events) {
    $settings->withBinding('::', 80);

    $events->onRequest(function(swoole_http_request $request, swoole_http_respose $response) {
        $response->end('Hello World!');
    });
});

Servant awareness

The Factory implementation is servant aware and allows to chain additional servants to the given servants. Due to implementation decisions, you can not replace the first servant. An exception will be thrown when you try to set a different servant., (*4)

License and Maintainer(s)

This package is licensed under the MIT license. This package is actively maintained by:, (*5)

  • Matthias Kaschubowski

The Versions

28/01 2017

dev-master

9999999-dev

Catalyst Swoole Foundation

  Sources   Download

MIT

The Requires

 

by Matthias Kaschubowski

28/01 2017

v0.1.1

0.1.1.0

Catalyst Swoole Foundation

  Sources   Download

MIT

The Requires

 

by Matthias Kaschubowski

28/01 2017

v0.1

0.1.0.0

Catalyst Swoole Foundation

  Sources   Download

MIT

The Requires

  • php >=7.0
  • ext-swoole *

 

by Matthias Kaschubowski