0
7
Login
Code
Issues
Pull requests
Events
Packages
6e22c11846924b7c133180b8c6bbf2c749eb5330
6e22c11846924b7c133180b8c6bbf2c749eb5330

confd

Latest Stable Version Total Downloads License

Requirements

  • PHP >= 8.0
  • Hyperf >= 3.0

Installation

composer require friendsofhyperf/confd:^3.0

Command

Fetch configs from etcd/consul and upgrade .env.

php bin/hyperf.php confd:env

Listener

<?php

namespace App\Listener;

use FriendsOfHyperf\Confd\Event\ConfigChanged;
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Event\Annotation\Listener;
use Hyperf\Event\Contract\ListenerInterface;

#[Listener()]
class ConfigChangedListener implements ListenerInterface
{
    public function __construct(private StdoutLoggerInterface $logger)
    {
    }

    public function listen(): array
    {
        return [
            ConfigChanged::class,
        ];
    }

    public function process(object $event): void
    {
        $this->logger->warning('[confd] ConfdChanged');
        // do something
    }
}

Support

  • Etcd
  • Consul