PHPackages                             macloudapisdk/sdk - 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. macloudapisdk/sdk

ActiveLibrary[API Development](/categories/api)

macloudapisdk/sdk
=================

macloud.pro SDK

v1.0.0(5mo ago)00PHPPHP &gt;=5.6

Since Jan 16Pushed 5mo agoCompare

[ Source](https://github.com/macloud-api/macloud-php)[ Packagist](https://packagist.org/packages/macloudapisdk/sdk)[ RSS](/packages/macloudapisdk-sdk/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (2)Used By (0)

API PHP SDK
===========

[](#api-php-sdk)

A PHP SDK for interacting with the Macloud API. This SDK provides a simple and secure way to make RESTful API requests with built-in signature authentication.

Features
--------

[](#features)

- Support for GET, POST, PATCH, PUT, and DELETE HTTP methods
- Built-in SHA256 signature authentication
- RESTful API design
- JSON request/response format
- Configurable timeout settings
- Optional logging support

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

[](#requirements)

- PHP &gt;= 5.5
- Composer

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

[](#installation)

Install the package via Composer:

```
composer require macloudapisdk/sdk
```

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

[](#configuration)

Before using the SDK, you need to obtain the following credentials:

- **app\_id**: Your application ID (contact technical support to register an account and apply for API credentials)
- **app\_secret**: Your application secret key (used for signature generation)
- **base\_api\_url**: The base API URL (e.g., `http://api.local.com/V4/`). Contact operations staff for the specific address.

### Configuration Parameters

[](#configuration-parameters)

ParameterDescriptionRequired`app_id`Your assigned application IDYes`app_secret`Your assigned application secret, used for data signingYes`base_api_url`API base URL prefixYes`timeout`Request timeout in seconds (default: 10)No`log`Enable SDK logging (default: false)No`logfileLinux`Linux log file path (e.g., `/tmp/sdk.log`)NoUsage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

```
error_reporting(E_ALL);
ini_set('display_errors', 'on');

require './vendor/autoload.php';

try {
    $config = [
        'app_id'       => getenv('SDK_APP_ID'),
        'app_secret'   => getenv('SDK_APP_SECRET'),
        'base_api_url' => getenv('SDK_API_PRE'),
        // 'log'          => true,           // Enable SDK logging
        // 'logfileLinux' => '/tmp/sdk.log', // Linux log file path
    ];
    $sdk = new \macloudapisdk\Sdk($config);

    // Your API calls here...

} catch(\Exception $e) {
    var_dump("code: " . $e->getCode() . " message: " . $e->getMessage());
}
```

### GET Request

[](#get-request)

```
$request = [
    'url' => 'test.sdk.get',
    'query' => [
        "page" => 1,
        "pagesize" => 10,
        "data" => [
            "name" => "name名称",
            "domain" => "baidu.com",
        ],
    ],
    'body' => [],
];
$result = $sdk->get($request);
$jsonData = json_decode($result, 1);
print_r("api: ".$request['url']."\n");
print_r("raw: ".$result."\n");
print_r($jsonData);
print_r("\n");
```

### POST Request

[](#post-request)

```
$request = [
    'url' => 'test.sdk.post',
    'query' => [],
    'body' => [
        "page" => 1,
        "pagesize" => 10,
        "data" => [
            "name" => "name名称",
            "domain" => "baidu.com",
        ],
    ],
];
$result = $sdk->post($request);
$jsonData = json_decode($result, 1);
print_r("api: ".$request['url']."\n");
print_r("raw: ".$result."\n");
print_r($jsonData);
print_r("\n");
```

### PATCH Request

[](#patch-request)

```
$request = [
    'url' => 'test.sdk.patch',
    'query' => [],
    'body' => [
        "page" => 1,
        "pagesize" => 10,
        "data" => [
            "name" => "name名称",
            "domain" => "baidu.com",
        ],
    ],
];
$result = $sdk->patch($request);
$jsonData = json_decode($result, 1);
print_r("api: ".$request['url']."\n");
print_r("raw: ".$result."\n");
print_r($jsonData);
print_r("\n");
```

### PUT Request

[](#put-request)

```
$request = [
    'url' => 'test.sdk.put',
    'query' => [],
    'body' => [
        "page" => 1,
        "pagesize" => 10,
        "data" => [
            "name" => "name名称",
            "domain" => "baidu.com",
        ],
    ],
];
$result = $sdk->put($request);
$jsonData = json_decode($result, 1);
print_r("api: ".$request['url']."\n");
print_r("raw: ".$result."\n");
print_r($jsonData);
print_r("\n");
```

### DELETE Request

[](#delete-request)

```
$request = [
    'url' => 'test.sdk.delete',
    'query' => [],
    'body' => [
        "page" => 1,
        "pagesize" => 10,
        "data" => [
            "name" => "name名称",
            "domain" => "baidu.com",
        ],
    ],
];
$result = $sdk->delete($request);
$jsonData = json_decode($result, 1);
print_r("api: ".$request['url']."\n");
print_r("raw: ".$result."\n");
print_r($jsonData);
```

Signature Algorithm
-------------------

[](#signature-algorithm)

The SDK uses SHA256 signature authentication to ensure data integrity during transmission:

- **Client-side**: Uses SHA256 algorithm to sign the base64-encoded parameters combined with `app_secret`. Each request includes the signature.
- **Server-side**: Uses the same algorithm to sign the received parameters and compares it with the provided signature to verify authenticity.

This ensures that data cannot be tampered with during transmission.

Important Notes
---------------

[](#important-notes)

1. **URI and Query Parameters**: For all requests, URI and GET parameters are separated. For example, if the URL is `https://api.local.com/V4/version?v=1`, the `v=1` parameter must be passed through the `query` parameter in the request array.
2. **Return Value**: Each API call returns a raw string response. You can decode it using `json_decode()` to get the parsed JSON data.
3. **Error Handling**: Always wrap SDK calls in try-catch blocks to handle exceptions properly.

API Response Format
-------------------

[](#api-response-format)

The SDK returns the raw response string. The API typically returns JSON format, which can be decoded using `json_decode($result, true)` to get an associative array.

Support
-------

[](#support)

For API credentials and base URL information, please contact:

- **Technical Support**: For `app_id` and `app_secret` registration
- **Operations Staff**: For the specific API base URL

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance71

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

168d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/253652273?v=4)[macloud-api](/maintainers/macloud-api)[@macloud-api](https://github.com/macloud-api)

---

Top Contributors

[![102er](https://avatars.githubusercontent.com/u/58157051?v=4)](https://github.com/102er "102er (2 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/macloudapisdk-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/macloudapisdk-sdk/health.svg)](https://phpackages.com/packages/macloudapisdk-sdk)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M984](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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