1. Go to this page and download the library: Download cmdrsharp/netbox-laravel 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/ */
cmdrsharp / netbox-laravel example snippets
use CmdrSharp\NetBox\Ipam\Prefix;
$prefix = new Prefix([
'prefix' => '172.16.0.0/24', // Prefixes are specified according to the NetBox API Docs
'role' => 1, // This is an ID referring to the resource in NetBox
'site' => 1, // This is an ID referring to the resource in NetBox
'tenant' => 1, // This is an ID referring to the resource in NetBox
'vlan' => 1, // This is an ID referring to the resource in NetBox
'is_pool' => false,
'description' => 'Cool Network',
'vrf' => 1, // This is an ID referring to the resource in NetBox
'status' => 'active'
]);
$prefix->create();
// Returns a Guzzle ResponseInterface with getBody and getStatusCode methods.
use CmdrSharp\NetBox\Ipam\Prefix;
$prefix = new Prefix();
$prefix->setPrefix('172.16.0.0/24')
->setRole(1)
->setSite(1)
->setTenant(1)
->setVlan(1)
->setPool(false)
->setDescription('Cool Network')
->setVrf(1)
->setStatus('active')
->create();
use CmdrSharp\NetBox\Ipam\Prefix;
Prefix::wherePrefix('172.16.0.0/24');
// Returns a Guzzle ResponseInterface with getBody and getStatusCode methods.