承接 mustafaculban/commonroom-php-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mustafaculban/commonroom-php-sdk

最新稳定版本:v1.0.0

Composer 安装命令:

composer require mustafaculban/commonroom-php-sdk

包简介

PHP SDK for Common Room API

README 文档

README

Un-Official PHP SDK for Common Room API integration.

Installation

You can install the package via composer:

composer require mustafaculban/commonroom-php-sdk

Usage

use CommonRoom\CommonRoom;
// Initialize the SDK
$commonRoom = new CommonRoom('your-api-key');
// Use services
try {
// Get contacts
$contacts = $commonRoom->contacts()->getContacts();
// Get activity types
$activityTypes = $commonRoom->activities()->getActivityTypes();
// Add a tag
$tag = $commonRoom->tags()->createTag([
'name' => 'My Tag',
'description' => 'Tag description'
]);
} catch (\Exception $e) {
echo "Error: " . $e->getMessage();
}

Advanced Configuration

You can pass additional configuration options when initializing the SDK:

// Initialize with API key and configuration
$commonRoom = new CommonRoom('your-api-key', [
    'timeout' => 45, // Request timeout in seconds
    'connect_timeout' => 15, // Connection timeout in seconds
    'base_url' => 'https://api.commonroom.io/community/v1' // Optional custom base URL
]);
// Make requests through services
$contacts = $commonRoom->contacts()->getContacts();

Available Services

  • ApiTokenService
  • ActivitiesService
  • ContactsService
  • SegmentsService
  • TagsService

Testing

To run the tests, you'll need to set up your test environment:

  1. Copy .env.testing.example to .env.testing:
cp .env.testing.example .env.testing
  1. Update .env.testing with your test API key:
COMMONROOM_TEST_API_KEY=your-test-api-key-here
  1. Run the tests:
composer test

Note: For CI/CD, make sure to set the COMMONROOM_TEST_API_KEY secret in your GitHub repository settings.

Documentation

For detailed API documentation, please visit Common Room API Documentation.

Contributing

Please see CONTRIBUTING.md for details.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-28