hexa2k9 / netbox-php

NetBox API Client for PHP

Home Page:https://github.com/hexa2k9/netbox-php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NetBox PHP

Note, this is a fork of the Wicked Software Corp. "Laravel NetBox" Package, original Credits go to them.

The Package was refactored to allow Installation as a standalone composer package (thus is available under the port389 namespace for this package). The package was tested against NetBox v3.2.2 while implementing NetBox in the company I'm working for in "scratch your own itch"-Mode. We mainly use the IPAM module in NetBox, other components are not heavily tested.

Installation

composer require port389/netbox-php

Environment Variables

The package requires 2 environment variables being set accessible through getenv()

Variable Type Default Description
NETBOX_API string "" the NetBox API Endpoint (e.g. http://localhost:8080/api)
NETBOX_API_KEY string "" The NetBox API Key created from eg http://127.0.0.1:8080/user/api-tokens/

Example Usage

$api = new \port389\NetBox\Api\IPAM\IpAddresses(new \port389\NetBox\Client());
$result = $api->add([
    'address'  => '11.22.33.44/32',
    'dns_name' => 'foo.example.com'
]);

$result = $api->list(['address' => '11.22.33.44/32'])

Supported NetBox APIs

About

NetBox API Client for PHP

https://github.com/hexa2k9/netbox-php

License:Other


Languages

Language:PHP 100.0%