PHPackages                             motan/motan-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. motan/motan-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

motan/motan-php
===============

Motan For PHP

v1.1.10(1y ago)811130[5 issues](https://github.com/weibocom/motan-php/issues)PHP

Since Aug 24Pushed 1y ago15 watchersCompare

[ Source](https://github.com/weibocom/motan-php)[ Packagist](https://packagist.org/packages/motan/motan-php)[ RSS](/packages/motan-motan-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (20)Used By (0)

Motan-PHP
=========

[](#motan-php)

[![License](https://camo.githubusercontent.com/a549a7a30bacba7bfceebdc207a8e86c3f2c02995a2527640dca30048fd2b64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d417061636865253230322e302d626c75652e737667)](https://github.com/weibocom/motan/blob/master/LICENSE)[![codecov](https://camo.githubusercontent.com/894d0b86d6ad4f4aa4c431a05e5159adc36af761a93ec12a50f0fcdb4a6cb7b9/68747470733a2f2f636f6465636f762e696f2f67682f776569626f636f6d2f6d6f74616e2d7068702f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/weibocom/motan-php)[![PHPUnit for motan-php](https://github.com/weibocom/motan-php/workflows/PHPUnit%20for%20motan-php/badge.svg)](https://github.com/weibocom/motan-php/actions)

Overview
========

[](#overview)

[Motan](https://github.com/weibocom/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
===========

[](#quick-start)

Installation
------------

[](#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](https://github.com/motan-ecosystem/motan-examples#for-php) .

**Usage:**

we need an defined constant `MOTAN_PHP_ROOT` for load the motan php libs. Just like the demo does.

```
define('MOTAN_PHP_ROOT', './vendor/motan/motan-php/src/Motan/');
require MOTAN_PHP_ROOT . 'init.php';
```

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](#documents). the demo case is in the main/ directory

Motan server
------------

[](#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](https://github.com/motan-ecosystem/motan-examples/tree/master/weibo-mesh)

***As a CGI agent to php-fpm***

```
  cgi-mesh-example-helloworld:
    path: com.weibo.motan.HelloWorldService
    export: "motan2:9991"
    provider: cgi
    CGI_HOST: 10.211.55.3
    CGI_PORT: 9000
    CGI_REQUEST_METHOD: GET
    CGI_SCRIPT_FILENAME: /motan-examples/php-server/index.php
    CGI_DOCUMENT_ROOT: /motan-examples/php-server
    basicRefer: mesh-server-basicService
```

***As a HTTP agent to any HTTP Server***

```
  http-mesh-example-helloworld:
    path: com.weibo.motan.HelloWorldService
    export: "motan2:9990"
    provider: http
    HTTP_REQUEST_METHOD: GET
    HTTP_URL: http://10.211.55.3:9900/http_server
    basicRefer: mesh-server-basicService
```

Motan Client
------------

[](#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.sh` to find more.

```
$app_name = 'search';
$service = 'com.weibo.HelloMTService';
$group = 'motan-demo-rpc';
$remote_method = 'HelloW';
$params = ['idevz'=>'for weibo-mesh'];
$cx = new Motan\MClient( $app_name );
$request = new \Motan\Request($service, $remote_method, $params);
$request->setGroup($group);
try{
    $res = $cx->doCall($request);
} catch(Exception $e) {
    var_dump($e->getMessage());
}
```

Unit Test
=========

[](#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。

```
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
```

Contributors
============

[](#contributors)

- 周晶([@idevz](https://github.com/idevz))
- 罗明刚([@lion2luo](https://github.com/lion2luo))
- 郭万韬
- 丁振凯
- 李枨煊([@flyhope](https://github.com/flyhope))
- 吴桦([@cocowh](https://github.com/cocowh))

License
=======

[](#license)

Motan is released under the [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).

Welcome to submit issue and contribute code！

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 84.7% 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 ~169 days

Recently: every ~488 days

Total

14

Last Release

564d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9984b8596db239e90d357abcafa4afddcd170f4d5e61c48a27bc671207c5df33?d=identicon)[cocowh](/maintainers/cocowh)

![](https://www.gravatar.com/avatar/8a22030f5a9d21d6ab3e2c7455d3591a23c56b122fe2f49fd7040be5f881ec5d?d=identicon)[rayzhang0603](/maintainers/rayzhang0603)

---

Top Contributors

[![idevz](https://avatars.githubusercontent.com/u/2113827?v=4)](https://github.com/idevz "idevz (127 commits)")[![snail007](https://avatars.githubusercontent.com/u/4533203?v=4)](https://github.com/snail007 "snail007 (12 commits)")[![rayzhang0603](https://avatars.githubusercontent.com/u/2917437?v=4)](https://github.com/rayzhang0603 "rayzhang0603 (6 commits)")[![cocowh](https://avatars.githubusercontent.com/u/17496282?v=4)](https://github.com/cocowh "cocowh (3 commits)")[![comdeng](https://avatars.githubusercontent.com/u/5013951?v=4)](https://github.com/comdeng "comdeng (1 commits)")[![flyhope](https://avatars.githubusercontent.com/u/5442948?v=4)](https://github.com/flyhope "flyhope (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/motan-motan-php/health.svg)

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

###  Alternatives

[hasan-ahani/filament-otp-input

Otp input for filament

2678.1k](/packages/hasan-ahani-filament-otp-input)

PHPackages © 2026

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