PHPackages                             cis-bv/netbox-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. cis-bv/netbox-client

ActiveLibrary[API Development](/categories/api)

cis-bv/netbox-client
====================

NetBox Client with supporting of GraphQl

v0.1.0(1y ago)011MITPHPPHP ^8.3

Since Oct 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/cis-ks/NetBox)[ Packagist](https://packagist.org/packages/cis-bv/netbox-client)[ RSS](/packages/cis-bv-netbox-client/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

PHP NetBox API/GraphQL Client
=============================

[](#php-netbox-apigraphql-client)

This is a simple fluent-based PHP client for the [NetBox](https://github.com/netbox-community/netbox/) API.

Installation
------------

[](#installation)

```
composer require cis-bv/netbox-client

```

Create Client-Instance
----------------------

[](#create-client-instance)

The URL (with or without /api) and the NetBox-Token can either be provided directly by passing to the Class Constructor or via (OS-provided) Environment-Variables:

```
use Cis\NetBox\NetBoxApi;

// direct passing
$netBoxApi = new NetBoxApi('https://demo.netbox.dev', '3d7d31797de934a99a527a620514130980937b4c');

// using the Environment-Variables (OS or set)
putenv(NETBOX_API_URL, 'https://demo.netbox.dev');
putenv(NETBOX_TOKEN, '3d7d31797de934a99a527a620514130980937b4c');
$netBoxApi = new NetBoxApi();
```

API
---

[](#api)

All API-calls are made fluently and are based on the URL of the endpoint. For Hypen-based paths you need to convert it to camelCase:

For retrieving data you omit the "Get"-Method. All filters ar passed in an array:

```
use Cis\NetBox\NetBoxApi;

$netBoxApi = new NetBoxApi();

// Getting all Console-Ports
$consolePorts = $netBoxApi->dcim()->consolePorts();

// Getting all Console-Ports for a specific device
$consolePorts = $netBoxApi->dcim()->consolePorts(['device_id' => 12]);
```

For all Non-Get-Operations add the necessary Method to the End of the function name:

- `Create` for adding Models
- `Put` or `Patch` for updating Models
- `Delete` for deleting Models

```
// Creating a new Console Port
$consolePorts = $netBoxApi->dcim()->consolePortsCreate([
    'device' => 245,
    'name' => 'con'
]);
```

For Referencing a direct instance of a Model you need to add ById between the path and method and also reference the ID as the first parameter:

```
use Cis\NetBox\NetBoxApi;
$netBoxApi = new NetBoxApi();

//Get a specific Interface:
$netBoxApi->dcim()->interfacesById(12);

//Delete a specific Console Port:
$netBoxApi->dcim()->consolePortsByIdDelete(234);
```

GraphQL
-------

[](#graphql)

To perform a GraphQL query you simply passing an Instance of the `Cis\GqlBuilder\Query`-Class or a simple string with the query.

```
use Cis\NetBox\NetBoxApi;
use Cis\GqlBuilder\Query;

$netBoxApi = new NetBoxApi();
$query = Query::create('device_list', selectionSet: ['id', 'name']);

$allDevices = $netBoxApi->graphQl($query);
```

Return
------

[](#return)

All Functions return either an `NetBoxResult` or `NetBoxGraphQlResult` in case of a GraphQL-Query.

You can iterate over `NetBoxResult` and use it as Array, even if it is just on instance of a model.

It also holds additional information about the request:

```
use Cis\NetBox\NetBoxApi;
$netBoxApi = new NetBoxApi();

$consolePorts = $netBoxApi->dcim()->consolePorts();

//Retrieve the status code of the request
$statusCode = $consolePorts->getStatusCode();

//Retrieve the plain Body
$body = $consolePorts->getBody();

//Retrieve the Result(s) always as array:
$results = $consolePorts->getResults();

//Use Result as Array
foreach ($consolePorts as $consolePort) {
    echo $consolePort->id . PHP_EOL;
}
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

621d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/59171582?v=4)[cis-ks](/maintainers/cis-ks)[@cis-ks](https://github.com/cis-ks)

---

Top Contributors

[![cis-ks](https://avatars.githubusercontent.com/u/59171582?v=4)](https://github.com/cis-ks "cis-ks (4 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/cis-bv-netbox-client/health.svg)

```
[![Health](https://phpackages.com/badges/cis-bv-netbox-client/health.svg)](https://phpackages.com/packages/cis-bv-netbox-client)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M985](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
