1. Go to this page and download the library: Download fluffy/php-eureka-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fluffy / php-eureka-client example snippets
use EurekaClient\EurekaClient;
use EurekaClient\Instance\Instance;
use EurekaClient\Instance\Metadata;
use EurekaClient\Instance\DataCenterInfo;
use GuzzleHttp\Client;
// We will use app name and instance id for making requests below.
$appName = 'new_app';
$instanceId = 'test_instance_id';
// Create app instance metadata.
$metadata = new Metadata();
$metadata->set('test_key', 'test_value');
// Create data center metadata (flix.appinfo.AmazonInfo')
->setMetadata($dataCenterMetadata);
// Create data center info (Own Data Center).
$dataCenterInfo = new DataCenterInfo();
$dataCenterInfo
->setName('MyOwn')
->setClass('com.netflix.appinfo.MyDataCenterInfo');
// Create Eureka app instance.
$instance = new Instance();
$instance
->setInstanceId($instanceId)
->setHostName('test_host_name')
->setApp($appName)
->setIpAddr('127.0.0.1')
->setPort(80)
->setSecurePort(433)
->setHomePageUrl('http://localhost')
->setStatusPageUrl('http://localhost/status')
->setHealthCheckUrl('http://localhost/health-check')
->setSecureHealthCheckUrl('https://localhost/health-check')
->setVipAddress('test_vip_address')
->setSecureVipAddress('test_secure_vip_address')
->setMetadata($metadata)
->setDataCenterInfo($dataCenterInfo);