PHPackages                             oldshiji/siwo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. oldshiji/siwo

ActiveProject[Framework](/categories/framework)

oldshiji/siwo
=============

this is a simple framework base on swoole4.2.7

0.5(7y ago)24114MITPHP

Since Nov 29Pushed 6y ago3 watchersCompare

[ Source](https://github.com/oldshiji/siwo)[ Packagist](https://packagist.org/packages/oldshiji/siwo)[ RSS](/packages/oldshiji-siwo/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (5)Used By (0)

Siwo
====

[](#siwo)

基于swoole4.2.x版本封装的简易框架

框架实现了
-----

[](#框架实现了)

1. http控制器,tcp控制器,udp控制器,websocket控制器,socket控制器的封装，只需要定义好路由编写对应的控制器即可使用
2. 简易封装了mysql协程客户端，简单实现了类似tp的DB用法

框架安装
----

[](#框架安装)

1.composer create-project oldshiji/siwo siwo 目前沿无稳定版本，安装时请指定版本即可

框架和单片机通信实验
----------

[](#框架和单片机通信实验)

[![logo](https://github.com/oldshiji/siwo/raw/master/tmp/mcu.png)](https://github.com/oldshiji/siwo/blob/master/tmp/mcu.png)框架启动
--------------------------------------------------------------------------------------------------------------------------------

[](#框架启动)

1. 启动 php siwod start [![logo](https://github.com/oldshiji/siwo/raw/master/tmp/siwo.png)](https://github.com/oldshiji/siwo/blob/master/tmp/siwo.png)
2. 停止 php siwod stop
3. 重启 php siwod restart

### HTTP Controller

[](#http-controller)

```
/**
 * Created by PhpStorm.
 * User: 1655664358@qq.com
 * Date: 2018/11/19
 * Time: 13:36
 */
Route::group(['prefix'=>'api','middleware'=>'web'],function(){
    Route::get("user/test","UserController@test");
    Route::get("user/lists","UserController@testa");
    Route::post("video/clip","VideoController@clip");
    Route::post("video/division","VideoController@clipFilter");

    Route::get("chan/test","ChanController@test");

});

Route::group(['middleware'=>'api'],function(){
    Route::get("user/test/a","UserController@test");
    Route::get("user/lists/a","UserController@lists");
});
/**
 * Created by PhpStorm.
 * User: 1655664358@qq.com
 * Date: 2018/11/21
 * Time: 13:28
 */
namespace App\Http\Controllers;

use Siwo\Foundation\Database\Db;
use Siwo\Foundation\HttpController;
use Swoole\Coroutine;
use Swoole\Process;

class VideoController extends HttpController
{

    public function clip()
    {

        Coroutine::create(function (){
            $from_second = $this->request->post['from_second'];//00:00:20
            $to_second   = $this->request->post['to_second'];
            if (empty($from_second))$this->response->write("视频起始时间参数未传递");
            if (empty($to_second))$this->response->write("视频结束时间参数未传递");

            $video = "/home/video/video.mp4";

            $video_name = date("Ymdhis").".mp4";
            $video_dest = "/home/video/".$video_name;
            $video_output= "https://www.itkucode.com/".$video_name;

            $cmd = "/usr/local/bin/ffmpeg -i ".$video." -vcodec copy -acodec copy -ss ".$from_second." -to ".$to_second." ".$video_dest." -y";
            $ret = Coroutine::exec($cmd);

            if (isset($ret['code']) && $ret['code'] == 0){
                $this->response->end($video_output);
            }

        });

    }
```

### Tcp Controller

[](#tcp-controller)

```
/**
 * Created by PhpStorm.
 * User: 1655664358@qq.com
 * Date: 2018/11/21
 * Time: 20:37
 */
namespace App\Tcp\Controllers;
use Siwo\Foundation\Database\Db;
use Siwo\Foundation\TcpController;
use Swoole\Coroutine;

class TestController extends TcpController
{
    public function index()
    {
        $this->server->send($this->fd,'hello,siwo');
    }

}
```

### Udp Controller

[](#udp-controller)

```
/**
 * Created by PhpStorm.
 * User: 1655664358@qq.com
 * Date: 2018/11/24
 * Time: 18:09
 */
namespace App\Udp\Controllers;

use Siwo\Foundation\UdpController;

class UserController extends UdpController
{
    public function index()
    {
        $this->server->sendto($this->clientInfo['address'],$this->clientInfo['port'],json_encode($this->getClientInfo()));
    }

}
```

### websocket Controller

[](#websocket-controller)

```
/**
 * Created by PhpStorm.
 * User: 1655664358@qq.com
 * Date: 2018/11/28
 * Time: 15:11
 */
namespace App\Ws\Controllers;

use Siwo\Foundation\WebsocketController;

class UserController extends WebsocketController
{
    public function index()
    {
        echo $this->frame->data;
        $this->getServer()->push($this->fd,"hello,swoole");
    }
}

PS:不在维护和管理了
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Total

4

Last Release

2690d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f8a66c208e703241532031f3af8e34bf6247be25604ec2698532fcd9077a3175?d=identicon)[jackcsm](/maintainers/jackcsm)

---

Top Contributors

[![immortalChensm](https://avatars.githubusercontent.com/u/35517798?v=4)](https://github.com/immortalChensm "immortalChensm (29 commits)")

---

Tags

simple-swoole-frameworksiwosocketswooleswoole-frameworktcpudpwebsocketasyncframeworkswoolesiwo

### Embed Badge

![Health badge](/badges/oldshiji-siwo/health.svg)

```
[![Health](https://phpackages.com/badges/oldshiji-siwo/health.svg)](https://phpackages.com/packages/oldshiji-siwo)
```

###  Alternatives

[easyswoole/easyswoole

An efficient swoole framework

4.8k186.9k50](/packages/easyswoole-easyswoole)[easyswoole/mysqli

An efficient swoole framework

34120.5k27](/packages/easyswoole-mysqli)[easyswoole/redis

easyswoole component

3391.8k12](/packages/easyswoole-redis)[easyswoole/orm

php stander lib

3088.7k17](/packages/easyswoole-orm)[easyswoole/compiler

easyswoole component

691.1k](/packages/easyswoole-compiler)[easyswoole/fast-cache

An efficient swoole framework

1030.3k2](/packages/easyswoole-fast-cache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
