Overview

Tencent Server Framework is a coroutine and Swoole based server framework for fast server deployment which developed by Tencent engineers.

Requirements

  • Php5.5 +
  • Swoole1.7.18 +
  • linux,OS X

Introduction

  • Tencent Server Framework can help you to start your server quickly,you just need to set a few settings

How to start your server

cd /root/tsf/bin/
php swoole testHttpServ start
Copy the code

  • Support Cmds: start,stop,reload,restart,status,shutdown,startall,list

How to use Muticall

  • Beside that,we also support Muticall:
  • you can use Muticall to send TCP,UDP packets at the sametime
  • when all the requests come back,return to interrupt
  
  $res = (yield $this->muticallTest());
  
  public function muticallTest() {
    $calls=new Swoole\Client\Multi(a);
    $firstReq=new Swoole\Client\TCP($ip.$port.$data.$timeout);
    $secondReq=new Swoole\Client\UDP($ip.$port.$data.$timeout);
    $thirdReq= new Swoole\Client\HTTP("http://www.qq.com");

    $calls ->request($firstReq.'first');             //first request
    $calls ->request($secondReq.'second');             //second request
    $calls ->request($thirdReq.'third');             //third request
    yield $calls;
  }

  var_dump($res)
  Copy the code

Router

  • We support individuation route rules
  • now we realize some universal route rules and restful rules
  • besides that, we also support default GET parameter
  URL                                       METHOD       CONTROLLER  ACTION
  http://127.0.0.1:80 / Test? h=1 ANY ==> TestController/ActionIndex

  http://127.0.0.1:80 / Test/send? h=1 ANY ==> TestController/ActionSend
  Restful
  http://127.0.0.1:80 / rest GET = = > TestController/action list
  http://127.0.0.1:80 / rest/Test / 22 GET = = > TestController/ActionView
                                                         Get['id']=22
  http://127.0.0.1:80 / rest/Test POST = = > TestController/ActionCreate
  http://127.0.0.1:80 / rest/Test / 22 PUT = = > TestController/ActionUpdate
                                                         Get['id']=22
  http://127.0.0.1:80 / rest/Test / 22 DELETE = = > TestController/ActionDelete
                                                         Get['id']=22
  http://127.0.0.1:80 / rest/Test/send / 1 / li GET = = > TestController/ActionSend
                                                         Get['cid']=1 Get['name']=li

Copy the code

Contribution

Your contribution to TSF development is very welcome!

You may contribute in the following ways: