PHPackages                             gyoung/eureka-sidecar - 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. gyoung/eureka-sidecar

AbandonedLibrary

gyoung/eureka-sidecar
=====================

base on swoft2.0, php eureka sidecar

v1.1.0(6y ago)9963Apache-2.0PHPPHP &gt;=7.1

Since Sep 19Pushed 6y agoCompare

[ Source](https://github.com/guoyoung/eureka-sidecar)[ Packagist](https://packagist.org/packages/gyoung/eureka-sidecar)[ RSS](/packages/gyoung-eureka-sidecar/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (3)Used By (0)

php eureka sidecar
==================

[](#php-eureka-sidecar)

- 基于swoft2.0.5+，简单实现php对eureka的注册，发现，心跳，调用转发等。

github
======

[](#github)

-

安装
==

[](#安装)

- 通过composer安装

```
composer require gyoung/eureka-sidecar

```

使用
==

[](#使用)

基础配置
----

[](#基础配置)

- 在config下新增sidecar.php，内容如下：

```
  return [
      'enable' => true,         //是否启用
      'isProxy' => false,       //是否代理的非swoft框架服务，使用swoft框架时已实现healthUri，无需关心，默认false使用swoft
      'eurekaUrls' => 'http://127.0.0.1:8761/eureka',    //eureka注册地址，多个由逗号隔开，如果地址没有端口会自动添加默认端口8761
      'serverPort' => 8089,       //sidecar端口
      'port' => 8089,             //代理服务端口
      'ipAddress' => 'http://127.0.0.1',        //代理服务ip,为空则通过swoole_get_local_ip()获取本机eth0的ip
      'healthUri' => '/health',    //被代理服务需提供的心跳uri，返回格式必须为: ['status' => 'UP'], json后返回，默认：/health，使用swoft框架不用填写
      'applicationName' => 'sidecar-test',  //应用名称
      'sidecarTableMaxLength' => 4096,  //swoole table单个key最大储存长度
      'pullAppTime' => 20000,  //定时拉取实例/ms，默认20000ms
      'healthTime' => 5000,   //定时健康检查/ms，默认5000ms
  ];

```

- 采用自定义进程进行健康检查和拉取服务，因此使用时需在bean.php中添加如下配置(http server为例)：

```
  'httpServer' => [
      ...
      'process' => [
          'sidecar' => bean(\Sidecar\Process\SidecarProcess::class)
      ],
      ...
  ],

```

- 代理服务需提供能访问的在sidecar.php中配置的 healthUri

```
/**
 * @return \Swoft\Http\Message\Response|\Swoft\WebSocket\Server\Message\Response
 * @throws \Swoft\Exception\SwoftException
 * @RequestMapping("/health")
 */
public function health()
{
    return $this->json(['status' => 'UP']);
}

```

- 正常启动swoft后就会向eureka注册，定时拉取服务实例，服务实例储存在swoole table中

Agent
-----

[](#agent)

```
/**
 * @Inject()
 * @var Agent
 */
private $agent;

/**
 * @return array|mixed
 * @throws \ReflectionException
 * @throws \Sidecar\Exception\SidecarException
 * @throws \Swoft\Bean\Exception\ContainerException
 */
public function sidecar()
{
    $result = $this->agent->proxy('SERVICE-CLIENT', '/user', 'GET', ['id' => 1]);
    var_dump($result);
}

```

- application:获取所有实例信息
- proxy:服务调用转发

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community6

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 ~4 days

Total

2

Last Release

2424d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2a318208436a9a93ec4baa3f8f20d7be8a05ff0f2f9276025f5c0d4c428b41d?d=identicon)[583045376@qq.com](/maintainers/583045376@qq.com)

---

Top Contributors

[![guoyoung](https://avatars.githubusercontent.com/u/18422548?v=4)](https://github.com/guoyoung "guoyoung (26 commits)")

### Embed Badge

![Health badge](/badges/gyoung-eureka-sidecar/health.svg)

```
[![Health](https://phpackages.com/badges/gyoung-eureka-sidecar/health.svg)](https://phpackages.com/packages/gyoung-eureka-sidecar)
```

PHPackages © 2026

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