stardots-io/stardots-sdk-php
Composer 安装命令:
composer require stardots-io/stardots-sdk-php
包简介
PHP SDK for StarDots platform
README 文档
README
StarDots-SDK-PHP
Introduction
This project is used to help developers quickly access the StarDots platform and is written in PHP. Compatible with PHP 5.5+.
Requirements
PHP version >= 5.5.0
cURL extension
JSON extension
Installation
Using Composer (Recommended)
composer require stardots-io/stardots-sdk-php
Manual Installation
- Download the source code
- Include the autoloader or manually include the files
- Use the SDK
Usage
Basic Example
<?php require_once 'vendor/autoload.php'; use StarDots\StarDots; // Initialize the SDK $clientKey = "Your client key"; $clientSecret = "Your client secret"; $stardots = new StarDots($clientKey, $clientSecret); // Or use the static create method $stardots = StarDots::create($clientKey, $clientSecret); // Get space list $params = [ 'page' => 1, 'pageSize' => 20 ]; $response = $stardots->getSpaceList($params);
API Examples
Get Space List
$params = [ 'page' => 1, 'pageSize' => 50 ]; $response = $stardots->getSpaceList($params);
Create Space
$params = [ 'space' => 'demo', 'public' => true ]; $response = $stardots->createSpace($params);
Delete Space
$params = [ 'space' => 'demo' ]; $response = $stardots->deleteSpace($params);
Toggle Space Accessibility
$params = [ 'space' => 'demo', 'public' => false ]; $response = $stardots->toggleSpaceAccessibility($params);
Get Space File List
$params = [ 'page' => 1, 'pageSize' => 50, 'space' => 'demo' ]; $response = $stardots->getSpaceFileList($params);
Get File Access Ticket
$params = [ 'space' => 'demo', 'filename' => 'example.png' ]; $response = $stardots->fileAccessTicket($params);
Upload File
$fileContent = file_get_contents('path/to/file.png'); $params = [ 'space' => 'demo', 'filename' => 'example.png', 'fileContent' => $fileContent ]; $response = $stardots->uploadFile($params);
Delete File
$params = [ 'space' => 'demo', 'filenameList' => ['example.png', 'example2.jpg'] ]; $response = $stardots->deleteFile($params);
Error Handling
try { $response = $stardots->getSpaceList(); } catch (StarDots\StarDotsException $e) { echo "Error: " . $e->getMessage(); }
Response Format
All API responses follow this format:
[
'code' => 200,
'message' => 'Success',
'requestId' => 'unique-request-id',
'bool' => true,
'ts' => 1640995200000,
'data' => [
// Response data
]
]
Documentation
https://stardots.io/en/documentation/openapi
Homepage
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-26
