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:
- Copy
.env.testing.exampleto.env.testing:
cp .env.testing.example .env.testing
- Update
.env.testingwith your test API key:
COMMONROOM_TEST_API_KEY=your-test-api-key-here
- 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
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-28