Download the PHP package ocolin/netbox without Composer
On this page you can find all versions of the php package ocolin/netbox. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ocolin/netbox
More information about ocolin/netbox
Files in ocolin/netbox
Package netbox
Short Description PHP REST client for Netbox
License MIT
Homepage https://github.com/ocolin/netbox
Informations about the package netbox
Netbox
What is it?
This is a small PHP client for the Netbox API REST services.
Requirements
- PHP >=8.3
- guzzlehttp/guzzle 7.10
- ocolin/global-type ^2.0
Installation
TODO
- Add an images upload function
- Integration testing for Netbox 3.
Configuration
The client can be configured in two ways. Via environment variables, and constructor arguments.
Properties
| Environment Name | Argument Name | Type | Default | Description |
|---|---|---|---|---|
| NETBOX_API_HOST | $host | string | N/A | Hostname of Netbox server |
| NETBOX_API_AUTH | $auth | integer | 2 | Authentication version 1 or 2 |
| NETBOX_API_TOKEN | $token | string | N/A | API Auth token |
| NETBOX_API_KEY | $key | string | N/A | API Key for version 2 auth |
Note: Version 2 authentication takes both a key and a token, while Version 1 only uses a token.
Environment Variables
Constructor arguments
The constructor takes a configuration object that allows you to add your configuration settings. These can also be used in conjunction with environment variables. Any missing parameters will be checked in the Environment.
Options
As can be seen in previous example, there is an options parameter. This allows you to specify Guzzle HTTP client settings if needed. This can be useful if you want to enable SSL verification, or HTTP timeout, etc. The client defaults to SSL verification off.
HTTP defaults
| Option | Default | Description |
|---|---|---|
| timeout | 20 | Seconds to give HTTP attempt |
| verify | false | Verify SSL credentials |
Response
The client outputs a response object with the following parameters:
| Property Name | Type | Description |
|---|---|---|
| status | integer | HTTP status code |
| statusMessage | string | HTTP status message |
| headers | array | List of response headers |
| body | mixed | HTTP response body content |
Method functions
Path interpolation
Any {tokens} found in the endpoint path will be replaced with matching keys from the $query array. Those keys are then removed from the query string automatically.
Note: Netbox requires a trailing slash on all endpoint paths. The client adds one automatically if missing.
GET
Get a resource
POST
Create a new resource
PATCH
Update a value in a resource
PUT
Update/Replace an entire resource
DELETE
Delete a resource
OPTIONS
OPTIONS returns information about an endpoint.