PHPackages                             totoro/apollo-config - 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. totoro/apollo-config

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

totoro/apollo-config
====================

1.3.0(7y ago)946MITPHPPHP &gt;=7.0.0

Since May 17Pushed 6y ago2 watchersCompare

[ Source](https://github.com/yangjiekang/apollo-config)[ Packagist](https://packagist.org/packages/totoro/apollo-config)[ RSS](/packages/totoro-apollo-config/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (2)Dependencies (2)Versions (14)Used By (0)

Apollo config manage
--------------------

[](#apollo-config-manage)

- 方便程序快速获取配置参数
- 支持`redis`、`SHM`、`file` 存储方式
- `SHM` 只支持linux下使用
- Laravel 5.5+

Install
-------

[](#install)

```
composer require totoro/apollo-config

```

#### In Laravel

[](#in-laravel)

- 在 `config/app.php`

```
'providers' => [
    ...
    ...
    Totoro\Apollo\ApolloServiceProvider::class,
]

```

#### In Lumen

[](#in-lumen)

- 在 `bootstrap/app.php`

```
$app->configure('apollo');
$app->register(Totoro\Apollo\ApolloServiceProvider::class);

```

Usage
-----

[](#usage)

```
//值是否存在
app('apollo')->has($key)

//获取某个值
app('apollo')->get($key)

//获取所有值
app('apollo')->all()

```

重要说明
----

[](#重要说明)

`APOLLO_DRIVER` 为 `file` 时只要很简单的配置就行

Configuration
-------------

[](#configuration)

- 执行 `php artisan apollo:publish-config` 将配置文件发布到 (`config/apollo.php`)

### 当 `APOLLO_DRIVER`设置为 `redis` 或者 `shm` 时

[](#当-apollo_driver设置为-redis-或者-shm-时)

- 配置文件根据部署的参数设置好
- 执行 `php artisan apollo:publish-consul` 将注册中心的服务地址发布到存储库中
- 执行 `php artisan apollo:publish-component` 将配置中心参数发布到存储库中
- 可以执行 `php artisan apollo:clear-apollo` 清空当前存储库

#### Cron

[](#cron)

在 `app/Console/Kerner.php`中加上定时任务调用

```
protected $commands = [
    ...
    ...
    PublishConsulCommand::class,
    PublishComponentCommand::class
];

protected function schedule(Schedule $schedule)
{
    ...
    ...

    //更新注册中心服务地址
    $schedule->command(PublishConsulCommand::class)->everyMinute();
    //更新配置中心单当前服务参数
    $schedule->command(PublishComponentCommand::class)->everyMinute();
 }

```

- 启动调度器

```
* * * * * php /your-project-path/laravel/artisan schedule:run >> /dev/null 2>&1

```

### 当 `APOLLO_DRIVER`设置为 `file` 时

[](#当-apollo_driver设置为-file--时)

- `.env` 中设置配置文件的路径，默认 `/etc/xultra/php_conf`，当然也可以只直接在`config/apollo.php`中设置

```
APOLLO_DRIVER=file
APOLLO_CONF=/etc/xultra/php_conf

```

- 在配置文件 `/etc/xultra/php_conf` 中设置参数

```
xu-billing=http://127.0.0.1:1000
xu-audit=http://127.0.0.1000

```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Recently: every ~15 days

Total

13

Last Release

2869d ago

Major Versions

0.1.0 → 1.0.02018-05-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/b22905e4381e7c7ecdaf7af07a5d25664d975cb2c7dd07b9651e95e01e03e4c9?d=identicon)[yangjiekang](/maintainers/yangjiekang)

---

Top Contributors

[![yangjiekang](https://avatars.githubusercontent.com/u/18691475?v=4)](https://github.com/yangjiekang "yangjiekang (1 commits)")

### Embed Badge

![Health badge](/badges/totoro-apollo-config/health.svg)

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

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.8k69.4k](/packages/grumpydictator-firefly-iii)[unopim/unopim

UnoPim Laravel PIM

10.5k2.2k](/packages/unopim-unopim)[roundcube/roundcubemail

The Roundcube Webmail suite

7.0k1.4k3](/packages/roundcube-roundcubemail)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)[lion/bundle

Lion-framework configuration and initialization package

122.3k3](/packages/lion-bundle)

PHPackages © 2026

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