shift31/hostbase-api-client

This package is abandoned and no longer maintained. No replacement package was suggested.

The Hostbase API Client Library for PHP

0.2.0 2015-02-02 05:03 UTC

This package is not auto-updated.

Last update: 2020-01-20 03:19:17 UTC


README

Basic usage (if you're using Composer)

  • In your project, run composer require shift31/hostbase-api-client:dev-master
  • Example script:
<?php

require_once('vendor/autoload.php');

use Shift31\HostbaseClient;

/* The constructor will accept username and password parameters,
if you setup basic auth yourself, or for when I get around to implementing it. */
$client = new HostbaseClient("http://your.hostbase.server");

/* Optionally return arrays instead of objects */
//$client->decodeJsonAsArray();


// perform a search, limiting to 100 servers, retrieving just FQDNs
print_r($client->search('your.domain', 100, false));

// perform the same search, retrieving all data
print_r($client->search('your.domain', 100, true));

For an example of adding/updating hosts, check out the PuppetDB importer: https://github.com/shift31/hostbase-importer-puppetdb