PHPackages                             limingxinleo/thrift-go-phalcon-project - 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. limingxinleo/thrift-go-phalcon-project

ActiveProject

limingxinleo/thrift-go-phalcon-project
======================================

a phalcon porject for simple-subcontrollers

v1.4.0(8y ago)221664Apache-2.0PHPPHP &gt;=5.6

Since Sep 16Pushed 8y ago3 watchersCompare

[ Source](https://github.com/limingxinleo/thrift-go-phalcon-project)[ Packagist](https://packagist.org/packages/limingxinleo/thrift-go-phalcon-project)[ RSS](/packages/limingxinleo-thrift-go-phalcon-project/feed)WikiDiscussions thrift Synced 2d ago

READMEChangelog (6)Dependencies (5)Versions (18)Used By (0)

PHALCON框架结构
===========

[](#phalcon框架结构)

[![Total Downloads](https://camo.githubusercontent.com/22ae173783498d40a65293d858bf61c3f19f0106bcc090075e22a8383d8a7b8e/68747470733a2f2f706f7365722e707567782e6f72672f6c696d696e6778696e6c656f2f7068616c636f6e2d70726f6a6563742f646f776e6c6f616473)](https://packagist.org/packages/limingxinleo/phalcon-project)[![Latest Stable Version](https://camo.githubusercontent.com/2b9bab6fca28dbda53a3958a63461a846d0a383eb7400d1f749aa8e498559e86/68747470733a2f2f706f7365722e707567782e6f72672f6c696d696e6778696e6c656f2f7068616c636f6e2d70726f6a6563742f762f737461626c65)](https://packagist.org/packages/limingxinleo/phalcon-project)[![Latest Unstable Version](https://camo.githubusercontent.com/1438f8f8967b33f6abef125481d5a0c59b62ca1acc135b5711be952d5ec171a7/68747470733a2f2f706f7365722e707567782e6f72672f6c696d696e6778696e6c656f2f7068616c636f6e2d70726f6a6563742f762f756e737461626c65)](https://packagist.org/packages/limingxinleo/phalcon-project)[![License](https://camo.githubusercontent.com/726d4802ab4a0a4e716f71485508063f0f4ede78ed3284eb765efd81cedd7a4a/68747470733a2f2f706f7365722e707567782e6f72672f6c696d696e6778696e6c656f2f7068616c636f6e2d70726f6a6563742f6c6963656e7365)](https://packagist.org/packages/limingxinleo/phalcon-project)

[Phalcon 官网](https://docs.phalconphp.com/zh/latest/index.html)

[wiki](https://github.com/limingxinleo/simple-subcontrollers.phalcon/wiki)

安装
--

[](#安装)

1. 安装项目

```
composer create-project limingxinleo/thrift-go-phalcon-project

```

2. 使用Composer安装Thrift扩展后，把go的扩展包拷贝到GOPATH中(或建立软连接)。

```
ln -s  /your/path/to/thrift-go-phalcon-project/vendor/apache/thrift/lib/go/thrift thrift

```

3. 编译服务

- Go 使用 thrift -r --gen go:thrift\_import=thrift App.thrift
- Php 使用 thrift -r --gen php:server,psr4 App.thrift

4. Go服务安装

```
从GO官网下载编译好的压缩包 例如 go1.8.3.linux-amd64.tar.gz
$ tar -xzf go1.8.3.linux-amd64.tar.gz
$ mv go /usr/local/go/1.8.3
$ vim /etc/profile
export GOROOT='/usr/local/go/1.8.3' # 没有文件夹则新建
export GOPATH='/usr/local/go/libs/' # 没有文件夹则新建
export PATH=$GOROOT/bin:$PATH
$ go get -u github.com/kardianos/govendor
$ cd /usr/local/go/libs/src/github.com/kardianos/govendor/
$ go build
$ cd /usr/local/bin
$ ln -s /usr/local/go/libs/src/github.com/kardianos/govendor/govendor govendor

```

Go&amp;Swoole RPC 服务
--------------------

[](#goswoole-rpc-服务)

- Go thrift/gen-go/main.go

```
# RPC服务注册方法
server.RegisterProcessor("app", service.NewAppProcessor(&impl.App{}));

```

- Swoole app/tasks/Thrift/Service.php

```
$handler = new AppHandler();
$processor->registerProcessor('app', new AppProcessor($handler));

```

服务实现
----

[](#服务实现)

- Swoole app/thrift/Services/AppHandle.php

```
