All Projects → Tencent → Tsf

Tencent / Tsf

Licence: other
coroutine and Swoole based php server framework in tencent

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to Tsf

Swoft Im
基于swoft-cloud的微服务架构,最小化拆分粒度,PHP7、多进程、协程、异步任务、mysql连接池、redi连接池、rpc连接池、服务治理、服务注册与发现、Aop切面、全注解
Stars: ✭ 189 (-91.42%)
Mutual labels:  coroutines, swoole
Swoole Src
🚀 Coroutine-based concurrency library for PHP
Stars: ✭ 17,175 (+679.26%)
Mutual labels:  coroutines, swoole
Groupco
PHP的服务化框架。适用于Api、Http Server、Rpc Server;帮助原生PHP项目转向微服务化。出色的性能与支持高并发的协程相结合
Stars: ✭ 473 (-78.54%)
Mutual labels:  coroutines, swoole
Awesome Swoole
A curated list of Swoole
Stars: ✭ 283 (-87.16%)
Mutual labels:  coroutines, swoole
Smproxy
Swoole MySQL Proxy 一个基于 MySQL 协议,Swoole 开发的MySQL数据库连接池。 A MySQL database connection pool based on MySQL protocol and Swoole.
Stars: ✭ 1,665 (-24.46%)
Mutual labels:  coroutines, swoole
Acl
Server framework and network components written by C/C++ for Linux, Mac, FreeBSD, Solaris(x86), Windows, Android, IOS
Stars: ✭ 2,113 (-4.13%)
Mutual labels:  coroutines
Mvvmtemplate
An Android Template with MVVM and Clean Architecture
Stars: ✭ 182 (-91.74%)
Mutual labels:  coroutines
Poseidon
Poseidon Server Framework (refactor WIP)
Stars: ✭ 162 (-92.65%)
Mutual labels:  coroutines
Scrcast
Drop-in Android Screen Recording Library
Stars: ✭ 178 (-91.92%)
Mutual labels:  coroutines
Yii2 Swoole
make yii2 project runing on swoole
Stars: ✭ 161 (-92.7%)
Mutual labels:  swoole
The Movie Db Kotlin
The Movie DB app using Kotlin with updated Android features
Stars: ✭ 176 (-92.01%)
Mutual labels:  coroutines
Connection Pool
A common connection pool based on Swoole is usually used as a database connection pool.
Stars: ✭ 164 (-92.56%)
Mutual labels:  swoole
Php Msf Docs
PHP微服务框架开发手册,即Micro Service Framework For PHP Develop Manual
Stars: ✭ 185 (-91.61%)
Mutual labels:  swoole
Minicoro
Single header asymmetric stackful cross-platform coroutine library in pure C.
Stars: ✭ 164 (-92.56%)
Mutual labels:  coroutines
Anko Core
基于Kotlin+Anko+协程+Retrofit2的demo,完全采用anko DSL布局,也可以作为Android快速开发框架,大量常用工具类,扩展函数
Stars: ✭ 189 (-91.42%)
Mutual labels:  coroutines
Hyperf Skeleton
🛠 A skeleton of Hyperf framework that provided by official team
Stars: ✭ 162 (-92.65%)
Mutual labels:  swoole
Fountain
Android Kotlin paged endpoints made easy
Stars: ✭ 175 (-92.06%)
Mutual labels:  coroutines
Android Kotlin Mvi Cleanarchitecture
Android + Kotlin + Modularization + Gradle Depedency managment + Gradle written in Kotlin DSL + Custom Gradle Plugin + MVVM + MVI + Clean Architecture + Repository Pattern + Coroutines + Flows + Koin + Retrofit2 + ROOM + Kotlin-Android-Extension + KtLints
Stars: ✭ 187 (-91.52%)
Mutual labels:  coroutines
Phwoolcon
Phalcon + Swoole
Stars: ✭ 173 (-92.15%)
Mutual labels:  swoole
Android Clean Arch Coroutines Koin
Implemented by Clean Architecture, MVVM, Koin, Coroutines, Moshi, Mockk, LiveData & DataBinding
Stars: ✭ 173 (-92.15%)
Mutual labels:  coroutines

项目目前是存档状态,感谢您对腾讯开源项目的关注!您可以继续fork后更新迭代,感谢理解和支持;如果您有其他疑问,建议请发送邮件:[email protected] 与我们联系


Tencent Server Framework

Overview

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

Features

  • PHP Based. Compared with C++, the framework is more efficient in developing and programing.
  • based on Swoole extension. powerful async IO, timers and other infrastructure capacity can be used in this framework.
  • support PHP coroutine. Synchronous programing is possible using the coroutine schedule system, and can lead to the similar server capability with that of server deveoped in an asynchronous way.
  • support server monitor and provide interface to add more rules

Requirements

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

Installation

Introduction

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

Server config

vim server.ini

[server]
;server type:tcp,udp,http
type = http
; port
listen[] = 12312
; entrance file
root = '/data/web_deployment/serv/test/index.php'
;php start path
php = '/usr/local/php/bin/php'

[setting]
; worker process num
worker_num = 16
; task process num
task_worker_num = 0
; dispatch mode
dispatch_mode = 2
; daemonize
daemonize = 1
; system log
log_file = '/data/log/test.log'

How to start your server

cd /root/tsf/bin/
php swoole testHttpServ start
  • Support Cmds: start,stop,reload,restart,status,shutdown,startall,list

How to use TCP/UDP/HTTP Client

  • we support different network protocols: TCP,UDP,HTTP
  $tcpReturn=(yield $this->tcpTest());
  
  $udpReturn=(yield $this->udpTest());

  $httpReturn=(yield $this->httpTest());

  public function tcpTest(){
    $ip = '127.0.0.1';
    $port = '9905';
    $data = 'test';
    $timeout = 0.5; //second
    yield new Swoole\Client\TCP($ip, $port, $data, $timeout);
  }
  
  public function udpTest(){
    $ip = '127.0.0.1';
    $port = '9905';
    $data = 'test';
    $timeout = 0.5; //second
    yield new Swoole\Client\UDP($ip, $port, $data, $timeout);
  }
  
  public function httpTest(){
    $url='http://www.qq.com';
    $httpRequest= new Swoole\Client\HTTP($url);
    $data='testdata';
    $header = array(
      'Content-Length' => 12345,
    );
    yield $httpRequest->get($url); //yield $httpRequest->post($path, $data, $header);
  }

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();
    $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)
  

Concect to mysql async

    $sql = new Swoole\Client\MYSQL(array('host' => '127.0.0.1', 'port' => 3345, 'user' => 'root', 'password' => 'root', 'database' => 'test', 'charset' => 'utf-8',));
    $ret = (yield $sql ->query('show tables'));
    var_dump($ret);
    $ret = (yield $sql ->query('desc test'));
    var_dump($ret);
    

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/ActionList
  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

Performance

Contribution

Your contribution to TSF development is very welcome!

You may contribute in the following ways:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].