catalyst/swoole-foundation 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

catalyst/swoole-foundation

Composer 安装命令:

composer require catalyst/swoole-foundation

包简介

Catalyst Swoole Foundation

README 文档

README

Swoole Foundation Library

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.

Dependencies

This Package depends on catalyst/servant.

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.

License and Maintainer(s)

This package is licensed under the MIT license. This package is actively maintained by:

  • Matthias Kaschubowski

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固