midoks/php-eureka-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

midoks/php-eureka-client

Composer 安装命令:

composer require midoks/php-eureka-client

包简介

PHP client for the Netflix Eureka server.

README 文档

README

Build Status

PHP Eureka Client

PHP client for the Netflix Eureka server. Supports all Eureka REST operations.

Installation

Run

composer require midoks/php-eureka-client

or add dependency to your composer.json file

"require": {
    ...
    "midoks/php-eureka-client": "^1.0"
}

Usage example

1. Use needed packages

use Eureka\Client;

2. Create Eureka app instance

// We will use app name and instance id for making requests below.
$client = new \Euraka\Client($this->host, $this->port, $this->context);

3. Create Eureka client

// Create eureka v2 client.
$client = new EurekaClient('localhost', 8080);

// Create eureka v1 client.
$client = new EurekaClient('localhost', 8080, 'eureka');

4. Make requests

try {
  // Register new application instance.
  $response = $client->registerApp($appName, $instance);

  // Query for all instances.
  $allApps = $client->getAllApps();

  // Query for all application instances.
  $app = $client->getApp($appName);

  // Query for a specific application instance.
  $appInstance = $client->getAppInstance($appName, $instanceId);

  // Query for a specific instance.
  $instance = $client->getInstance($instanceId);

  // Send application instance heartbeat.
  $response = $client->heartBeat($appName, $instanceId);

  // Take instance out of service.
  $response = $client->takeInstanceOut($appName, $instanceId);

  // Put instance back into service.
  $response = $client->putInstanceBack($appName, $instanceId);

  // Update metadata.
  $response = $client->updateAppInstanceMetadata($appName, $instanceId, [
    'new_key' => 'new_value',
  ]);

  // Query for all instances under a particular vip address/
  $instances = $client->getInstancesByVipAddress('test_vip_address');

  // Query for all instances under a particular secure vip address.
  $instances = $client->getInstancesBySecureVipAddress('test_secure_vip_address');

  // De-register application instance.
  $response = $client->deRegisterApp($appName, $instanceId);
}
catch (Exception $e) {
  echo $e->getMessage() . PHP_EOL;
}

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2019-09-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固