PHPackages                             cmdrsharp/netbox-laravel - 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. cmdrsharp/netbox-laravel

ActiveLibr

cmdrsharp/netbox-laravel
========================

A client for creating/reading from NetBox

1.0.2.0(5y ago)3401Apache-2.0PHPPHP &gt;=7.4

Since Apr 21Pushed 4y ago2 watchersCompare

[ Source](https://github.com/CmdrSharp/netbox-laravel)[ Packagist](https://packagist.org/packages/cmdrsharp/netbox-laravel)[ RSS](/packages/cmdrsharp-netbox-laravel/feed)WikiDiscussions main Synced 1w ago

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

NetBox Laravel [![Latest Stable Version](https://camo.githubusercontent.com/6bf941e58a75593d7c31a259f2ee1ef19b41e96fae1b5881036e6429abe8d369/68747470733a2f2f706f7365722e707567782e6f72672f636d647273686172702f6e6574626f782d6c61726176656c2f762f737461626c65)](https://packagist.org/packages/cmdrsharp/netbox-laravel) [![StyleCI](https://camo.githubusercontent.com/03e4fad04d00546fc51de8ff870718dd44dabcd0e0ce0480028e154dc1983bed/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3336303132343339382f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/360124398?branch=main) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/9682f594e1cb237baffa5336295e8fc9bdce4f98c61af508f6bf11c3baa3efa0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f436d647253686172702f6e6574626f782d6c61726176656c2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/CmdrSharp/netbox-laravel/?branch=main) [![Apache licensed](https://camo.githubusercontent.com/62356e16a031f51cb7d2b9b5604a5c6293d8e39e6f69d45cdf480325de709fa2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4170616368652d626c75652e737667)](./LICENSE)
==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#netbox-laravel----)

This repo contains a client for interacting with the NetBox API - more specifically to be able to treat them more like resources (akin to Laravel models).

Each resource type defines a `fillable` property which allows mass assignment. Each property is named 1:1 with the NetBox API documentation. Resources also contain helper methods to allow easy lookups.

Current Requirements
====================

[](#current-requirements)

- PHP 7.4 or newer
- Laravel [7.0](https://laravel.com/docs/7.0) or newer
- NetBox (2.10 tested)

Installation
============

[](#installation)

Via composer

```
$ composer require cmdrsharp/netbox-laravel
```

After installation, publish the configuration file.

```
php artisan vendor:publish --provider="CmdrSharp\NetBox\NetBoxServiceProvider"

```

Which will create a `netbox.php` file in your Laravel config directory which contains keys for the NetBox URL and API Token. It is recommended to simply define these in your `.env` file. The config file will automatically read from these values.

```
NETBOX_URL=
NETBOX_API_TOKEN=5672

```

If you for some reason wish to disable SSL Validation toward the NetBox API, you can override validation in the `.env` file.

```
NETBOX_VERIFY_SSL=false

```

Usage
=====

[](#usage)

For creating a new resource, instantiate the correct model and call its create method.

```
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.
```

For your convenience, each resource also contains named set-methods that cover all fillable properties.

```
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();
```

### Example: Get a prefix from the NetBox API

[](#example-get-a-prefix-from-the-netbox-api)

```
use CmdrSharp\NetBox\Ipam\Prefix;

Prefix::wherePrefix('172.16.0.0/24');
// Returns a Guzzle ResponseInterface with getBody and getStatusCode methods.
```

Other resources
===============

[](#other-resources)

- [Laravel NetBox BGP](https://github.com/CmdrSharp/netbox-laravel-bgp) - Extension that includes BGP Resources

Developing
==========

[](#developing)

When creating new resources, please ensure to follow existing standards to ensure they remain compatible. The fillable array should ideally map 1:1 with the NetBox API Documentation. In cases where this requires special attribute management, we rely on the user knowing this ahead of time for mass assignment, and offer helpers in fluid setters to deal with these scenarios.

Currently, no validation of input should be performed. This is subject to change as we may opt to validate attributes according to NetBox API specs.

### Testing

[](#testing)

All resources should be covered by tests. Tests should extend the NetBoxTestCase class, which defines config values such as the URL to the NetBox Instance (which can easily be spun up via Docker) and a random API Key which should be created in said NetBox instance.

Versioning
==========

[](#versioning)

This package follows [Explicit Versioning](https://github.com/exadra37-versioning/explicit-versioning).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

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

Every ~0 days

Total

3

Last Release

1852d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5938745?v=4)[Marcus Frolander](/maintainers/CmdrSharp)[@CmdrSharp](https://github.com/CmdrSharp)

---

Top Contributors

[![CmdrSharp](https://avatars.githubusercontent.com/u/5938745?v=4)](https://github.com/CmdrSharp "CmdrSharp (13 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cmdrsharp-netbox-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/cmdrsharp-netbox-laravel/health.svg)](https://phpackages.com/packages/cmdrsharp-netbox-laravel)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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