"; ?> info(); // get es status $curl = curl_init(); // construct url curl_setopt($curl, CURLOPT_URL,"http://".$es_user.":".$es_password."@".$es_host."/_cluster/health"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); //executing curl $status = curl_exec($curl); // closing curl curl_close($curl); // decode $array = json_decode($status, true); # get version of elasticsearch php composer $composerLockPath = __DIR__ . '/composer.lock'; if (!file_exists($composerLockPath)) { die("The composer.lock file was not found.\n"); } $composerLock = json_decode(file_get_contents($composerLockPath), true); foreach ($composerLock['packages'] as $package) { if (strpos($package['name'], 'elasticsearch') !== false) { $phpPackName=$package['name']; $phpPackVersion=$package['version']; } } # check if package is installed if (empty($phpPackName)) { $phpPackName="not installed"; $phpPackVersion="not installed"; } // display result echo "

Informations

"; echo "

Elasticsearch cluster

"; echo "

Node name: ".$response['name']."
"; echo "Cluster name: ".$response['cluster_name']."
"; echo "Elasticsearch version: ".$response['version']['number']."
"; echo "Cluster health status: ".$array['status']."

"; echo "

Elasticsearch client for PHP

"; echo "

Package name: ".$phpPackName."
"; echo "Package version: ".$phpPackVersion."

";