The quick start gives very basic example of running client and server on the same machine. For the detailed information about using and developing Motan, please jump to Documents.
the demo case is in the main/ directory
Motan server
We use Weibo-Mesh to support a PHP Server, Weibo-Mesh is a local agent writen in Golang. But not only a agent, Wei-Mesh take the ability as service governance. There is an example at motan-example
Here is a simple example about Motan Client, it will call a remote service provider by [Weibo-Mesh Testhelper][testhelper], you can find more example in the [phpt tests][phpts], you can just run ./run.sh to find more.
If you use the local php environment to run unit tests, please make sure that your php version is between 7.2 and 7.4, supports functions such as pcntl_fork, posix_kill, pcntl_signal, etc., and downloaded the composer component.
You can run unit tests by following the instructions below。
git clone https://github.com/weibocom/motan-php.git
cd motan-php
git checkout $(test branch)
composer install
composer test # just run phpunit
composer test-coverage # run phpunit and generate report
If you do not want to install a php-related environment, it is recommended that you use docker to avoid problems with inconsistent environments.
You can follow the instructions below.
git clone https://github.com/weibocom/motan-php.git
cd motan-php
git checkout $(test branch)
docker run --rm -it -v $PWD:/mnt --entrypoint="" snail007/php:7.4 bash
cd /mnt
composer install
composer test # just run phpunit
composer test-coverage # run phpunit and generate report
Motan-PHP
Overview
Motan is a cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services.
This project is the PHP Motan implementation. Provides PHP motan client.
Quick Start
Installation
Using composer:
Just clone this project and add it to your
composer.json.WithOut Composer:
If you didn’t use composer for php libraries management, you would install motan-php by hand,like
git clone, please check the demo at motan-example .Usage:
we need an defined constant
MOTAN_PHP_ROOTfor load the motan php libs. Just like the demo does.The quick start gives very basic example of running client and server on the same machine. For the detailed information about using and developing Motan, please jump to Documents. the demo case is in the main/ directory
Motan server
We use Weibo-Mesh to support a PHP Server, Weibo-Mesh is a local agent writen in Golang. But not only a agent, Wei-Mesh take the ability as service governance. There is an example at motan-example
As a CGI agent to php-fpm
As a HTTP agent to any HTTP Server
Motan Client
Here is a simple example about Motan Client, it will call a remote service provider by [Weibo-Mesh Testhelper][testhelper], you can find more example in the [phpt tests][phpts], you can just run
./run.shto find more.Unit Test
If you use the local php environment to run unit tests, please make sure that your php version is between 7.2 and 7.4, supports functions such as pcntl_fork, posix_kill, pcntl_signal, etc., and downloaded the composer component. You can run unit tests by following the instructions below。
If you do not want to install a php-related environment, it is recommended that you use docker to avoid problems with inconsistent environments. You can follow the instructions below.
Contributors
License
Motan is released under the Apache License 2.0.
Welcome to submit issue and contribute code!