承接 ohtarr/netbox-php-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ohtarr/netbox-php-sdk

Composer 安装命令:

composer require ohtarr/netbox-php-sdk

包简介

Netbox API PHP SDK

README 文档

README

php library for accessing Netbox API.

This library was written to allow for multiple authentication headers as needed.

usage

instantiate new QueryBuilder object with correct parameters:

$params = [
    'baseurl'   =>  'https://netbox.mycompany.com',
    'tokens'    =>  [
        [
            'header'    =>  'Authorization',
            'prefix'    =>  'Bearer',
            'value'     =>  'TOKEN1 HERE',
        ],
        [
            'header'    =>  'apiauthorization',
            'prefix'    =>  'Token',
            'value'     =>  'TOKEN2 HERE',
        ],
    ],    
];
$nb = new Ohtarr\Netbox\QueryBuilder($params);

Create new model object

$locations = new Ohtarr\Netbox\DCIM\Locations($nb);

Create query

$locs = $locations->where('name','mylocname')->where('cf_alert','1')->get();

Use builtin helper methods to grab related objects

foreach($locs as $loc)
{
    print_r($loc->site());
}

Use ALL method to automatically receive all pages of data

$locs = $locations->where('cf_alert','1')->all();

Or just crank the pages up

$locs = $locations->limit(10000)->offset(0)->get();
$locs = $locations->where('limit',10000)->where('offset',0)->get();

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2023-05-23