PHP code example of ocolin / calix-axos-client

1. Go to this page and download the library: Download ocolin/calix-axos-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ocolin / calix-axos-client example snippets


// 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();

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

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

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

$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'
        ]   
);

$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'
        ]   
);

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

$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'
        ]   
);