承接 ocolin/calix-axos-client 相关项目开发

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

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

ocolin/calix-axos-client

最新稳定版本:v2.0.0

Composer 安装命令:

composer require ocolin/calix-axos-client

包简介

REST Client for Calix AXOS SMx Northbound server

README 文档

README

What is it?

A lightweight HTTP REST client for Calix AXOS Northbound interface.

No worrying about HTTP and authentication. Just provide an endpoint path and the payload data.

Table of Contents

Installation

composer require ocolin/calix-axos

Requirements

  • php ^8.3
  • guzzlehttp/guzzle ^7.10
  • ocolin/global-type ^2.0

Instantiation

The client can be configured either via constructor arguments or environment parameters.

Argument Name Environment Name Type Description
$host SMX_AXOS_HOST string Hostname/IP, port, and URI path
$usernmae SMX_AXOS_USERNAME string Username of account to use
$password SMX_AXOS_PASSWORD string Password of account to use

Using Environment variables

// Setting manually for demonstration
$_ENV['SMX_AXOS_HOST'] = 'https://smx.servername.com:18443/rest/v1/';
$_ENV['SMX_AXOS_USERNAME'] = 'api_user';
$_ENV['SMX_AXOS_PASSWORD'] = 'password1234';

$client = new Ocolin\CalixAxos\Client();

Using Constructor arguments

The constructor takes a DTO called Config.

$client = new Ocolin\CalixAxos\Client(
    client: new Ocolin\CalixAxos\Config(
            host: 'https://smx.servername.com:18443/rest/v1/',
        username: 'api_user',
        password: 'password1234'
    )
);

Options

The Config object can also take an options parameter for setting guzzle options such as HTTP timeout, verifying SSL, etc.

Default Options:

  • timeout: 20 sec
  • verify: false
$client = new Ocolin\CalixAxos\Client(
    client: new Ocolin\CalixAxos\Config(
        options: [
            'timeout' => 60,
            'verify'  => true  
        ]
    )
);

Response

The client will response with a data object containing the following properties:

Name Type Description
status integer HTTP response status code
statusMessage string HTTP response status message
headers array HTTP response headers
body array|object API response payload

Request Methods

The Calix API allows four HTTP methods, each is a function on the client:

Method Function Description
GET get() Retrieve existing resource(s)
POST post() Create a new resource
PUT put() Modify an existing resource
DELETE delete() Delete an existing resource

Parameters

Name Type Description
endpoint string The URI of an API endpoint
method string The HTTP method (only used in request())
query array|object Both path and URI query parameters
body array|object Payload from API server

Path Replacement

Any parameters in the query argument with names that match a variable token in the endpoint path name will swap those token names with their value. This allows you to past the endpoint URI as is from the docs and replace them automatically. See the GET method example below.

GET Method

$response = $client->get(
    endpoint: '/config/device/{device-name}/ont',
       query: [ 
            'device-name' => 'OLT-NAME',
            'ont-id'      => 777
       ]
);

POST Method

$response = $client->post(
    endpoint: '/config/device/{device-name}/ont',
       query: [ 'device-name' => 'OLT-NAME' ],
        body: [
            'ont-id'         => 777,
            'ont-reg-id'     => 777,
            'ont-type'       => 'Residential',
            'ont-profile-id' => '844G'
        ]   
);

PUT Method

$response = $client->put(
    endpoint: '/config/device/{device-name}/ont',
       query: [ 'device-name' => 'OLT-NAME' ],
        body: [
            'ont-id'         => 777,
            'ont-reg-id'     => 777,
            'ont-type'       => 'Business',
            'ont-profile-id' => '844G'
        ]   
);

DELETE Method

$response = $client->delete(
    endpoint: '/config/device/{device-name}/ont',
       query: [ 
            'device-name' => 'OLT-NAME',
            'ont-id'      => 777
       ]
);

Request Method

There is a request method which lets you manually specify the HTTP method to use rather than a specific method function.

$response = $client->request(
    endpoint: '/config/device/{device-name}/ont',
      method: 'POST',
       query: [ 'device-name' => 'OLT-NAME' ],
        body: [
            'ont-id'         => 777,
            'ont-reg-id'     => 777,
            'ont-type'       => 'Business',
            'ont-profile-id' => '844G'
        ]   
);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固