ocolin/calix-axos-client
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' ] );
ocolin/calix-axos-client 适用场景与选型建议
ocolin/calix-axos-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「http」 「rest」 「api」 「client」 「Guzzle」 「networking」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ocolin/calix-axos-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ocolin/calix-axos-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ocolin/calix-axos-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
A PSR-7 compatible library for making CRUD API endpoints
Api bundle
http客户端
Easily add Excepct-CT header to your project
Build mini web servers in PHP for testing
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-13