This repository is Experimental meaning that it's based on untested ideas or techniques and not yet established or finalized or involves a radically new and innovative style! This means that support is best effort (at best!) and we strongly encourage you to NOT use this in production.
####Requirements
- PHP Curl Extension
- PHP XSL Extension
"require": {
"packethost/packet": "dev-master"
},
<?php
require __DIR__ . '/vendor/autoload.php';
//Create a configuration object
$config = new PacketHost\Client\Adapter\Configuration\DefaultConfiguration(
'YOUR_API_KEY'
);
//Build the adapter and Api
$adapter = new PacketHost\Client\Adapter\GuzzleAdapter($config);
$api = new PacketHost\Client\PacketApi($adapter);
//Create options array with request params
$options = [
'queryParams' => 'per_page=20'
];
// Fetching projects
$projects = $api->project()->getAll($params);
var_dump($projects);
// Fetching facilities
$facilities = $api->facility()->getAll();
// Fetching Operating Systems
$oses = $api->operatingSystem()->getAll();
// Fetching Plans
$plans = $api->plan()->getAll();
// Creating a device
$device = new \PacketHost\Client\Domain\Device();
$projectId = 'PROJECT_ID';
$device->hostname = 'sample';
$device->facility = $facilities[0]->code;
$device->plan = $plans[0]->slug;
$device->operatingSystem = $oses[0]->slug;
$device = $api->device()->create($projectId, $device);
var_dump($device);
grunt ci