All Projects → zekunyan → ThriftDemo_PHP_CPP

zekunyan / ThriftDemo_PHP_CPP

Licence: other
Demo for Thrift RPC framework. PHP client call CPP server.

Programming Languages

PHP
23972 projects - #3 most used programming language
C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to ThriftDemo PHP CPP

Evernote Thrift
Thrift IDL files for the Evernote Cloud API
Stars: ✭ 94 (+224.14%)
Mutual labels:  thrift
Spring Thrift Starter
Set of cool annotations that helps you building Thrift applications with Spring Boot
Stars: ✭ 151 (+420.69%)
Mutual labels:  thrift
Harpc
基于Thrift的跨语言、高可用、高性能、轻量级的RPC框架。
Stars: ✭ 229 (+689.66%)
Mutual labels:  thrift
Dapeng Soa
A lightweight, high performance micro-service framework
Stars: ✭ 101 (+248.28%)
Mutual labels:  thrift
Herringbone
Tools for working with parquet, impala, and hive
Stars: ✭ 134 (+362.07%)
Mutual labels:  thrift
Elixir Thrift
A Pure Elixir Thrift Implementation
Stars: ✭ 182 (+527.59%)
Mutual labels:  thrift
Thrift connector
Clients of thrift, utilizing connection pools
Stars: ✭ 74 (+155.17%)
Mutual labels:  thrift
raster
A micro server framework, support coroutine, and parallel-computing, used for building flatbuffers/thrift/protobuf/http protocol service.
Stars: ✭ 19 (-34.48%)
Mutual labels:  thrift
Thrift Missing Guide
Thrift: The Missing Guide
Stars: ✭ 148 (+410.34%)
Mutual labels:  thrift
Go
decode/encode thrift message without IDL
Stars: ✭ 219 (+655.17%)
Mutual labels:  thrift
Php Thrift Sql
A PHP library for connecting to Hive or Impala over Thrift
Stars: ✭ 107 (+268.97%)
Mutual labels:  thrift
Aeraki
Manage any layer 7 traffic in Istio Service Mesh.
Stars: ✭ 119 (+310.34%)
Mutual labels:  thrift
Thrift Tools
thrift-tools is a library and a set of tools to introspect Apache Thrift traffic.
Stars: ✭ 189 (+551.72%)
Mutual labels:  thrift
Line Instant Messenger Protocol
It is work of Matti Virkkunen, link to http://altrepo.eu/git/line-protocol.git for latest update.
Stars: ✭ 96 (+231.03%)
Mutual labels:  thrift
Osquery Go
Go bindings for osquery
Stars: ✭ 249 (+758.62%)
Mutual labels:  thrift
Springboot Thrift Etcd Ribbon
基于springboot的thrift的rpc, 服务发现基于etcd,路由基于ribbon
Stars: ✭ 75 (+158.62%)
Mutual labels:  thrift
Finatra
Fast, testable, Scala services built on TwitterServer and Finagle
Stars: ✭ 2,126 (+7231.03%)
Mutual labels:  thrift
thrift-parser
A Thrift Parser built in TypeScript that generates a TypeScript AST that retains the Thrift grammar
Stars: ✭ 84 (+189.66%)
Mutual labels:  thrift
Hibari
Hibari is a production-ready, distributed, ordered key-value, big data store. Hibari uses chain replication for strong consistency, high-availability, and durability. Hibari has excellent performance especially for read and large value operations.
Stars: ✭ 253 (+772.41%)
Mutual labels:  thrift
Gunicorn thrift
Thrift app and worker for gunicorn!
Stars: ✭ 193 (+565.52%)
Mutual labels:  thrift

! This project is no longer maintained !


Thrift Demo. PHP client call CPP server

What is Thrift

Thrift is an interface definition language and binary communication protocol that is used to define and create services for numerous languages. It is used as a remote procedure call (RPC) framework and was developed at Facebook for "scalable cross-language services development". It combines a software stack with a code generation engine to build services that work efficiently to a varying degree and seamlessly between C#, C++ (on POSIX-compliant systems), Cappuccino, Cocoa, Delphi, Erlang, Go, Haskell, Java, Node.js, OCaml, Perl, PHP, Python, Ruby and Smalltalk. Although developed at Facebook, it is now an open source project in the Apache Software Foundation. The implementation was described in an April 2007 technical paper released by Facebook, now hosted on Apache. -- From Wiki Apache Thrift

This Demo

PHP client call CPP server.

Work Flow

  1. PHP client call with Request.
  2. CPP server response with Response.

image

Thrift interface definition

namespace cpp TTG
namespace php TTG

enum ResponseState {
    StateOk = 0,
    StateError = 1,
    StateEmpty = 2
}

struct Request {
    1: i32 studentID = 0
}

struct Response {
    1: i32 studentID = 0,
    2: string name,
    3: list<string> infos,
    4: ResponseState state
}

service TTGService {
    Response getStudentInfo(1: Request request);
}


Folders

CPP // CPP server source files
--CMakeLists.txt //CMake file
--... // Other cpp source files
PHP //PHP client source files
--Gen // Generated by thrift
--Thrift // Thrift php source files
--client.php // Client source file
ThriftGen // files generated by thrift
--gen-cpp
--gen-php
--TTG.thrift // definition file

How to run

Preparation

  • CMake, make, g++ ...
  • php, web server(apache or nginx, php-fpm)
  • thrift (How to install)

Compile and run

  1. cd ThriftDemo/CPP
  2. mkdir build
  3. cd build
  4. cmake ..
  5. make
  6. ./TTG.run // Run the CPP server
  7. Run ThriftDemo/PHP/client.php
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].