PHPackages                             route-connex/route-connex-sdk-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. route-connex/route-connex-sdk-php

ActiveLibrary[API Development](/categories/api)

route-connex/route-connex-sdk-php
=================================

PHP SDK for RouteConnex API

v1.0.2(5mo ago)04MITPHPPHP ^8.1.0

Since Oct 14Pushed 2mo agoCompare

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

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

route-connex-sdk-php
====================

[](#route-connex-sdk-php)

PHP SDK for the [RouteConnex API](https://www.routeconnex.com)

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

[](#requirements)

- PHP 8.1 or higher
- Composer

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

[](#installation)

Install the SDK using Composer:

```
composer require route-connex/route-connex-sdk-php
```

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

[](#configuration)

To use the SDK, you'll need your RouteConnex API credentials:

- **Client ID**
- **Client Secret**

You can obtain these credentials from your RouteConnex account.

Basic Usage
-----------

[](#basic-usage)

### Initialize the Client

[](#initialize-the-client)

```
use RouteConnex\RouteConnexSdkPhp\ErClient;
use RouteConnex\RouteConnexSdkPhp\ApiVersion;

// Create a new client instance
$client = ErClient::make(
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
    version: ApiVersion::V1  // Optional, defaults to V1
);

// Optional: Set a custom base URL (for testing or different environments)
$client->setBaseUrl('https://routeconnex.local:8080/api');
```

### API Versioning

[](#api-versioning)

The SDK currently supports API version V1:

```
use RouteConnex\RouteConnexSdkPhp\ApiVersion;

$client = ErClient::make(
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
    version: ApiVersion::V1
);
```

Available Endpoints
-------------------

[](#available-endpoints)

The SDK provides a fluent interface for accessing RouteConnex API endpoints:

### RouteConnex Endpoints

[](#routeconnex-endpoints)

#### About Endpoint

[](#about-endpoint)

Get information about the RouteConnex API:

```
$response = $client->routeConnex()->about()->get();
```

#### Test Authentication

[](#test-authentication)

Test your API authentication:

```
$response = $client->routeConnex()->testAuth()->get();
```

### Microsoft SharePoint Integration

[](#microsoft-sharepoint-integration)

#### List Files

[](#list-files)

List files from Microsoft SharePoint:

```
$response = $client->microsoftSharepoint()->files()->get(query: [
    'site_name' => 'your-site-name',
    'channel' => 'your-channel-name',
    '_meta_' => json_encode([
        'internal_id' => 12345,
    ]),
]);

$data = json_decode($response->getBody()->getContents(), true);
```

#### Upload File

[](#upload-file)

Upload a file to Microsoft SharePoint:

```
$response = $client->microsoftSharepoint()->files()->post(body: [
    'site_name' => 'your-site-name',
    'channel' => 'your-channel-name',
    'file_path' => '/path/to/your/file.pdf',
    'file_name' => 'uploaded-file.pdf',
    '_meta_' => [
        'internal_id' => 112233,
    ],
]);

$data = json_decode($response->getBody()->getContents(), true);
$runId = $data['data']['id'];
```

### HPE Content Manager Integration

[](#hpe-content-manager-integration)

#### List Records

[](#list-records)

Query records from HPE Content Manager:

```
$response = $client->hpeContentManager()->records()->get(query: [
    'query' => 'your-search-query',
    '_meta_' => json_encode([
        'internal_id' => 12345,
    ]),
]);

$data = json_decode($response->getBody()->getContents(), true);
```

#### Create Record

[](#create-record)

Create a new record in HPE Content Manager:

```
$response = $client->hpeContentManager()->records()->post(body: [
    'file_path' => '/path/to/your/file.pdf',
    'record_title' => 'My Document Title',
    'record_type' => 'Document',
    'container_id' => 'container-123',
    'author_email' => 'author@example.com',
    'author_default_id' => 'author-id-123',
    'finalize_on_save' => true,
    'make_new_revision' => true,
    '_meta_' => [
        'internal_id' => 112233,
    ],
]);

$data = json_decode($response->getBody()->getContents(), true);
$runId = $data['data']['id'];
```

### Run Status Checking

[](#run-status-checking)

Many operations in RouteConnex are asynchronous and return a run ID. You can check the status of these operations:

```
// Get run status
$response = $client->run()->_id_($runId)->get();
$run = json_decode($response->getBody()->getContents(), true);
$status = $run['data']['status']['id'];

// Status can be: 'created', 'queued', 'running', 'succeeded', 'failed'
if ($status === 'succeeded') {
    $responseData = $run['data']['response_data'];
    // Process successful response
}
```

#### Polling for Completion

[](#polling-for-completion)

Example of polling until a run completes:

```
$runId = $data['data']['id'];
$maxAttempts = 20;
$attempt = 0;

do {
    $run = $client->run()->_id_($runId)->get();
    $runData = json_decode($run->getBody()->getContents(), true);
    $status = $runData['data']['status']['id'];

    if (in_array($status, ['created', 'queued', 'running'])) {
        if ($attempt >= $maxAttempts) {
            throw new Exception('Operation timeout');
        }
        sleep(1);
        $attempt++;
        continue;
    }

    if ($status === 'succeeded') {
        $responseData = $runData['data']['response_data'];
        // Process successful response
    } else {
        // Handle failed status
    }

    break;
} while (true);
```

Working with Responses
----------------------

[](#working-with-responses)

All endpoint methods return a PSR-7 `ResponseInterface` object:

```
use Psr\Http\Message\ResponseInterface;

$response = $client->routeConnex()->about()->get();

// Get status code
$statusCode = $response->getStatusCode(); // 200

// Get headers
$contentType = $response->getHeader('Content-Type'); // ['application/json']

// Get response body
$body = $response->getBody()->getContents();
$data = json_decode($body, true);

// Check response structure
if ($data['status'] === 'success') {
    $result = $data['data'];
}
```

Error Handling
--------------

[](#error-handling)

The SDK throws exceptions for various error conditions:

```
use RouteConnex\RouteConnexSdkPhp\Exceptions\InvalidHttpMethodException;
use RouteConnex\RouteConnexSdkPhp\Exceptions\NotAuthenticatedException;
use GuzzleHttp\Exception\ServerException;

try {
    $response = $client->microsoftSharepoint()->files()->get(query: [
        'site_name' => 'your-site',
    ]);
} catch (ServerException $e) {
    // Handle API errors (4xx, 5xx responses)
    $errorResponse = $e->getResponse();
    $statusCode = $errorResponse->getStatusCode();
    $errorBody = $errorResponse->getBody()->getContents();
} catch (NotAuthenticatedException $e) {
    // Handle authentication errors
} catch (InvalidHttpMethodException $e) {
    // Handle invalid HTTP method errors
}
```

Advanced Usage
--------------

[](#advanced-usage)

### Custom HTTP Requests

[](#custom-http-requests)

You can make custom HTTP requests using the low-level HTTP method:

```
use RouteConnex\RouteConnexSdkPhp\HttpMethod;

$response = $client->runHttpRequest(
    HttpMethod::GET,
    'route-connex/about'
);
```

### Method Chaining

[](#method-chaining)

The SDK supports fluent method chaining for clean, readable code:

```
$response = ErClient::make('client-id', 'client-secret')
    ->setBaseUrl('https://routeconnex.local:8080/api')
    ->microsoftSharepoint()
    ->files()
    ->get(query: ['site_name' => 'my-site']);
```

API Reference
-------------

[](#api-reference)

### ErClient Methods

[](#erclient-methods)

- `make(string $clientId, string $clientSecret, ApiVersion $version = ApiVersion::V1): ErClient` - Create a new client instance
- `setBaseUrl(string $baseUrl): ErClient` - Set custom base URL
- `getBaseUrl(): string` - Get current base URL
- `routeConnex(): RouteConnexEndpoint` - Access RouteConnex endpoints
- `microsoftSharepoint(): MicrosoftSharepointEndpoint` - Access Microsoft SharePoint endpoints
- `hpeContentManager(): HpeContentManagerEndpoint` - Access HPE Content Manager endpoints
- `run(): RunEndpoint` - Access run status endpoints

### HTTP Methods

[](#http-methods)

Endpoints support the following HTTP methods where applicable:

- `get(array $query = []): ResponseInterface` - GET request with query parameters
- `post(array $body = []): ResponseInterface` - POST request with body data
- `put(array $body = []): ResponseInterface` - PUT request with body data
- `patch(array $body = []): ResponseInterface` - PATCH request with body data
- `delete(): ResponseInterface` - DELETE request

Note: Not all endpoints support all HTTP methods. Check the API documentation or endpoint implementation for supported methods.

License
-------

[](#license)

This SDK is open-sourced software licensed under the [MIT license](LICENSE.md).

Author
------

[](#author)

**Leo Oberle**

- Email:

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

### Dev Environment Configuration

[](#dev-environment-configuration)

For testing, create a `.env` file in the project root with your credentials:

```
BASE_URL=https://routeconnex.local:8080/api/

# Microsoft SharePoint Configuration
MS_SP_CLIENT_ID=your-client-id
MS_SP_CLIENT_SECRET=your-client-secret
MS_SP_RUN_ID=test-run-id
MS_SP_SITE_NAME=your-site-name
MS_SP_CHANNEL_NAME=your-channel-name

# HPE Content Manager Configuration
HPE_CM_CLIENT_ID=your-client-id
HPE_CM_CLIENT_SECRET=your-client-secret
HPE_CM_RUN_ID=test-run-id
HPE_CM_RECORD_TYPE=Document
HPE_CM_CONTAINER_ID=container-123
HPE_CM_AUTHOR_ID=author-id
HPE_CM_AUTHOR_EMAIL=author@example.com

# Test Files
TEST_FILE_PATH=/path/to/test/file.pdf
TEST_LARGE_FILE_PATH=/path/to/large/file.pdf
```

### Running Tests

[](#running-tests)

The SDK uses Pest PHP for testing:

```
# Run all tests
composer test

# Run tests with coverage
vendor/bin/pest --coverage
```

### Code Style

[](#code-style)

The SDK follows PSR-12 coding standards. Lint your code using Laravel Pint:

```
composer lint
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance80

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Every ~27 days

Total

3

Last Release

153d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e83170ca609616ce32facc98bddf14373f94577f6d15295f176ddd3db2242ef2?d=identicon)[leocello](/maintainers/leocello)

---

Top Contributors

[![leocello](https://avatars.githubusercontent.com/u/11424365?v=4)](https://github.com/leocello "leocello (36 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/route-connex-route-connex-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/route-connex-route-connex-sdk-php/health.svg)](https://phpackages.com/packages/route-connex-route-connex-sdk-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)
