akondas / symfony-consul-bundle
自动注册 Symfony 应用到 Consul
0.2.0
2022-10-01 13:29 UTC
Requires
- sensiolabs/consul-php-sdk: ^3.1
- symfony/console: ^5.0
- symfony/framework-bundle: ^5.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.11
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^1.8
- phpstan/phpstan-phpunit: ^1.1
- phpstan/phpstan-symfony: ^1.2
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-08-29 05:30:50 UTC
README
在 Consul 中注册和注销您的 Symfony 应用程序
1. 安装
composer require akondas/symfony-consul-bundle
2. 配置
在 Symfony 中启用此包,将以下行添加到您的 bundles.php
文件中
Akondas\ConsulBundle\ConsulBundle::class => ['all' => true]
添加路由
consul_bundle: resource: '@ConsulBundle/Resources/config/routing.yml'
配置参考
consul: service: name: 'subscription-service' # name of your app host: 'localhost' # host of your application under which it is available port: 8000 # port of your application under which it is available client: base_uri: http://127.0.0.1:8500 # consule server uri
3. 使用
可用命令
bin/console consul:register
- 在 Consul 中注册应用程序bin/console consul:deregister
- 从 Consul 注销应用程序bin/console debug:consul-check
- 调试 Consul 检查