PHPackages                             anocweb/netsapiens-api-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. anocweb/netsapiens-api-php

ActiveLibrary[API Development](/categories/api)

anocweb/netsapiens-api-php
==========================

PHP SDK for NetSapiens API v2

v0.1.0(8mo ago)031GPL-3.0-onlyPHPPHP &gt;=8.1

Since Sep 2Pushed 8mo agoCompare

[ Source](https://github.com/anocweb/netsapiens-api-php)[ Packagist](https://packagist.org/packages/anocweb/netsapiens-api-php)[ RSS](/packages/anocweb-netsapiens-api-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

NetSapiens PHP SDK
==================

[](#netsapiens-php-sdk)

A PHP SDK for interacting with NetSapiens API v1 and v2.

Installation
------------

[](#installation)

```
composer require anocweb/netsapiens-api-php
```

Usage
-----

[](#usage)

### Configuration Options

[](#configuration-options)

The SDK supports both traditional array configuration and OOP-style configuration:

#### Traditional Array Configuration

[](#traditional-array-configuration)

```
use NetSapiens\NetSapiensV2;
use NetSapiens\ApiVersion;

$client = new NetSapiensV2([
    'base_url' => 'https://your-netsapiens-server.com/v2',
    'access_token' => 'your-access-token',
    'timeout' => 60,
    'verify' => true
], ApiVersion::V44_4);
```

#### OOP-Style Configuration

[](#oop-style-configuration)

```
use NetSapiens\NetSapiensV2;
use NetSapiens\Config;
use NetSapiens\ApiVersion;

// Method chaining
$config = Config::create()
    ->baseUrl('https://your-netsapiens-server.com/v2')
    ->accessToken('your-access-token')
    ->timeout(60)
    ->verify(true);

$client = new NetSapiensV2($config, ApiVersion::V44_4);

// Or traditional setters
$config = new Config();
$config->setBaseUrl('https://your-netsapiens-server.com/v2');
$config->setAccessToken('your-access-token');
$config->setTimeout(60);
$config->setVerify(true);

$client = new NetSapiensV2($config, ApiVersion::V44_4);
```

### NetSapiens API v2 (Versioned)

[](#netsapiens-api-v2-versioned)

```
// Use specific API version (e.g., v44.4)
use NetSapiens\NetSapiensV2;
use NetSapiens\ApiVersion;

$client = new NetSapiensV2([
    'base_url' => 'https://your-netsapiens-server.com/v2',
    'access_token' => 'your-access-token'
], ApiVersion::V44_4);

// Get domains (organized by endpoint)
$domains = $client->domains->searchDomains();

// Get users in a domain
$users = $client->users->searchUsers('your-domain');

// Create a user
$user = $client->users->createUser('your-domain', [
    'user' => 'john.doe',
    'first_name' => 'John',
    'last_name' => 'Doe'
]);

// Authentication - Individual parameters (with validation)
$token = $client->authentication->getAccessTokenFromUserpass(
    'password',
    'client-id',
    'client-secret',
    'your-username',
    'your-password'
);

// Authentication - Configuration array
$token = $client->authentication->getAccessTokenFromUserpassWithConfig([
    'grant_type' => 'password',
    'client_id' => 'client-id',
    'client_secret' => 'client-secret',
    'username' => 'your-username',
    'password' => 'your-password'
]);
```

### NetSapiens API v1

[](#netsapiens-api-v1)

```
use NetSapiens\NetSapiensV1;
use NetSapiens\Config;

// Array configuration
$client = new NetSapiensV1([
    'base_url' => 'https://your-netsapiens-server.com',
    'access_token' => 'your-access-token'
]);

// Or OOP configuration
$config = Config::create()
    ->baseUrl('https://your-netsapiens-server.com')
    ->accessToken('your-access-token');

$client = new NetSapiensV1($config);

// Get queue statistics
$stats = $client->getQueueStats();

// Get CDR agent stats
$cdrStats = $client->getCDRAgentStats();
```

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

You can configure the SDK using environment variables:

```
NETSAPIENS_BASE_URL=https://your-netsapiens-server.com
NETSAPIENS_ACCESS_TOKEN=your-access-token
```

### Configuration Options

[](#configuration-options-1)

- `base_url`: NetSapiens server URL
- `access_token`: API access token
- `timeout`: Request timeout in seconds (default: 30)
- `verify`: SSL certificate verification (default: false)

### Dynamic Configuration Updates

[](#dynamic-configuration-updates)

```
// Access and modify configuration after client creation
$config = $client->getConfig();
$config->setTimeout(120);
$config->setVerify(true);
```

Available Versions
------------------

[](#available-versions)

- **v44.4**: `ApiVersion::V44_4`
- **v45.1**: `ApiVersion::V45_1`

```
// Default version (v44.4)
$client = new NetSapiensV2($config);

// Specific version
$client = new NetSapiensV2($config, ApiVersion::V45_1);
```

Endpoint Configuration
----------------------

[](#endpoint-configuration)

Each endpoint method supports both individual parameters and configuration arrays:

### Individual Parameters (Recommended)

[](#individual-parameters-recommended)

```
// Type-safe with validation and IDE support
$response = $client->authentication->getAccessTokenFromUserpass(
    'password',           // grant_type
    'your-client-id',     // client_id
    'your-client-secret', // client_secret
    'user@domain.com',    // username
    'password123'         // password
);
```

### Fluent Configuration

[](#fluent-configuration)

```
// Readable method chaining with self-documenting parameters
$response = $client->authentication->getAccessTokenFromUserpass()
    ->grant_type('password')
    ->client_id('your-client-id')
    ->client_secret('your-client-secret')
    ->username('user@domain.com')
    ->password('password123')
    ->request();
```

Response Handling
-----------------

[](#response-handling)

All methods return Response objects that support both array and object access:

### Object Property Access

[](#object-property-access)

```
$token = $client->authentication->getAccessTokenFromUserpass(...);

// Object properties
echo $token->status_code;  // HTTP status code
echo $token->bodyData;     // Response body data
echo $token->success;      // Boolean success flag
echo $token->error;        // Error message (if any)

// Methods
if ($token->isSuccess()) {
    $data = $token->getData();
}
```

### Array Access (Backward Compatible)

[](#array-access-backward-compatible)

```
// Array access - maintains backward compatibility
echo $token['status'];     // HTTP status code
echo $token['data'];       // Response body data
echo $token['success'];    // Boolean success flag
echo $token['error'];      // Error message

// Traditional usage
if ($token['success']) {
    $accessToken = $token['data']['access_token'];
}
```

Endpoint Organization
---------------------

[](#endpoint-organization)

Endpoints are organized by functionality:

- **Authentication**: Token management
- **Users**: User CRUD operations
- **Domains**: Domain management
- **PhoneNumbers**: Phone number operations
- **CallQueues**: Call center queue management
- **Voicemail**: Voicemail operations
- **And many more...**

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Guzzle HTTP client
- Composer for dependency management

License
-------

[](#license)

GPL-3.0-only

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance61

Regular maintenance activity

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

249d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1b00182ba65c1d0a76549ec24d848b16edb55a1410d0e032ac9d99099abddcfe?d=identicon)[anocweb](/maintainers/anocweb)

---

Top Contributors

[![clinton-exceltelecom](https://avatars.githubusercontent.com/u/161082073?v=4)](https://github.com/clinton-exceltelecom "clinton-exceltelecom (5 commits)")[![anocweb](https://avatars.githubusercontent.com/u/6542170?v=4)](https://github.com/anocweb "anocweb (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/anocweb-netsapiens-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/anocweb-netsapiens-api-php/health.svg)](https://phpackages.com/packages/anocweb-netsapiens-api-php)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
