PHPackages                             iprog/apollo-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. iprog/apollo-php

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

iprog/apollo-php
================

apollo配置中心php客户端（2345.com）

v2.0.0(6y ago)17MITPHPPHP ^7.1CI failing

Since Dec 23Pushed 6y ago1 watchersCompare

[ Source](https://github.com/zxwiProg/apollo-php)[ Packagist](https://packagist.org/packages/iprog/apollo-php)[ RSS](/packages/iprog-apollo-php/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (2)Dependencies (7)Versions (3)Used By (0)

apollo-php
==========

[](#apollo-php)

[![Php Version](https://camo.githubusercontent.com/c197ef1e57a32c886b2a54d02ead7dbc035f18b3f39a642703b9372eef7819f9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e312d627269676874677265656e2e7376673f6d61784167653d32353932303030)](https://secure.php.net/)[![Apollo-Client License](https://camo.githubusercontent.com/1fa18fb38c7ee44b7814c37b3ea4cefcc1963cdf8b2e554d1f97149c497b0e3d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f61706f6c6c6f2d2d636c69656e742d2d6c6963656e73652d4d49542d626c75652e7376673f6d61784167653d32353932303030)](https://secure.php.net/)[![Apollo-Client Copyright](https://camo.githubusercontent.com/2392e8d429b29d517b8a38b46cca3336ffe429dfeabff917d9f7ab0bda049bec/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f707972696768742d323334352e636f6d2d6c69676874677265792e7376673f6d61784167653d32353932303030)](https://secure.php.net/)

安装
--

[](#安装)

```
composer require iprog/apollo-php
```

依赖
--

[](#依赖)

- **PHP 7.1** or later

如何使用：
-----

[](#如何使用)

可以起一个定时任务，然后运行如下脚本即可，也可以将如下脚本写在一个死循环里面进行循环拉取， 具体各个项目可根据自己的情况决定自己的运用方案

```
require_once __DIR__ . "/xxx/vendor/autoload.php";

$config = new ApolloPhp\Popo\Config\ApolloHttpClientConfig();
$config->setApolloServerUrl("http://172.17.18.211:3880")
    ->setApolloAppId("php-unit-test-case")
    ->setApolloCluster("DEV");

$apolloRedisParam = new ApolloPhp\Popo\ApolloPullParam('redis');
$apolloRedisParam->setClientIp('127.0.0.1');
$apolloRedisParam->setReleaseKey('');

$apolloMysqlParam = new ApolloPhp\Popo\ApolloPullParam('mysql');
$apolloMysqlParam->setClientIp('127.0.0.1');
$apolloMysqlParam->setReleaseKey('');

$apolloPullParams = [$apolloRedisParam, $apolloMysqlParam];
$client = new ApolloPhp\Api\Impl\ApolloHttpClient($config);
$apolloConfigResult = $client->pullConfigs($apolloPullParams);

// 这里会将拉取的配置保存在php对应的配置目录里面
foreach ($apolloConfigResult as $result) {
    $apolloConfig = new ApolloPhp\Config\Impl\ApolloConfig('D://config');
    $apolloConfig->parseConfig($result);
}

```

apollo配置中心如何做配置：
----------------

[](#apollo配置中心如何做配置)

需要说明的是，apollo配置中心的配置以键值对形式存在，所以，为了方便apollo-php在代码层面做解析，apollo-php拟定了一个统一的配置方式，以下举例说明。

比如，现在我们要配置redis的链接参数信息，首先我们需要在apollo配置中心配置一个redis的namespace，然后在该namespace，可以做如下配置：

```
dev.master.host=127.0.0.1
dev.master.port=6379
dev.master.pwd=#343kdjer$
dev.slave.host=127.0.0.1
dev.slave.port=6379
dev.slave.pwd=#343kdjer$
test.master.host=127.0.0.1
test.master.port=6379
test.master.pwd=#343kdjer$
test.slave.host=127.0.0.1
test.slave.port=6379
test.slave.pwd=#343kdjer$
prod.master.host=127.0.0.1
prod.master.port=6379
prod.master.pwd=#343kdjer$
prod.slave.host=127.0.0.1
prod.slave.port=6379
prod.slave.pwd=#343kdjer$
```

可以从上面的配置看出，键使用点（.）做分割，则apollo-php解析后，会形成如下配置文件：

```

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~9 days

Total

2

Last Release

2328d ago

Major Versions

v1.0.0 → v2.0.02020-01-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8a27a299f3a4095fa85d9662c18f8ccae0a82701d821a3495131d58269f25f3?d=identicon)[octopus-iProg](/maintainers/octopus-iProg)

---

Top Contributors

[![zxwiProg](https://avatars.githubusercontent.com/u/59072557?v=4)](https://github.com/zxwiProg "zxwiProg (51 commits)")[![zxwmyemail](https://avatars.githubusercontent.com/u/5535618?v=4)](https://github.com/zxwmyemail "zxwmyemail (17 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)

PHPackages © 2026

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