Download the PHP package ocolin/calix-axos-client without Composer
On this page you can find all versions of the php package ocolin/calix-axos-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ocolin/calix-axos-client
More information about ocolin/calix-axos-client
Files in ocolin/calix-axos-client
Package calix-axos-client
Short Description REST Client for Calix AXOS SMx Northbound server
License MIT
Homepage https://github.com/ocolin/CalixAxos
Informations about the package calix-axos-client
Calix Axos
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
- What is it?
- Installation
- Requirements
- Instantiation
- Using Environment variables
- Using Constructor arguments
- Options
- Response
- Request Methods
- Parameters
- Path replacement
- GET Method
- POST Method
- PUT Method
- DELETE Method
- Request Method
Installation
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
Using Constructor arguments
The constructor takes a DTO called Config.
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
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
POST Method
PUT Method
DELETE Method
Request Method
There is a request method which lets you manually specify the HTTP method to use rather than a specific method function.