repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Message/Broadcast/Broadcast.php | RongCloud/Lib/Message/Broadcast/Broadcast.php | <?php
/**
* Broadcast message
*/
namespace RongCloud\Lib\Message\Broadcast;
use RongCloud\Lib\ConversationType;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Broadcast {
/**
* @var string The path of the broadcast message
*/
private $jsonPath = 'Lib/Message/Broadcast/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file for validation
*
* @var string
*/
private $verify = '';
/**
* System constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* @param array $Message Broadcast message recall
* @param
* $message = [
* 'senderId'=> 'test',// Sender ID
* "objectName"=>'RC:RcCmd',// Message type
* 'content'=>[
* 'uId'=>'xxxxx',// Unique message identifier, obtained after sending a broadcast message via /push, returned as id.
* 'type'=>'SYSTEM',// System session
* 'isAdmin'=>'0',// Whether it is an administrator, default is 0; when set to 1, the IMKit SDK will display a gray bar as "Admin recalled a message" upon receiving this message.
* 'isDelete'=>0]// Whether to delete the message, default is 0. When recalling this message, the client will delete it and replace it with a gray bar recall prompt message; when set to 1, the message will be deleted without being replaced by a gray bar prompt message.
* ];
* @return array
*/
public function recall(array $Message=[]){
$conf = $this->conf['broadcast'];
$verify = $this->verify['broadcast'];
if(isset($verify['targetId'])){
unset($verify['targetId']);
}
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'message',
'data'=> $Message,
'verify'=> $verify
]);
if($error) return $error;
$Message['content'] = isset($Message['content'])?json_decode($Message['content'],true):[];
$content = $Message['content'];
$Message = (new Utils())->rename($Message, [
'senderId'=> 'fromUserId',
]);
$content = (new Utils())->rename($content , [
'uId'=>'messageUId'
]);
$content['conversationType'] = 6;
$Message['content'] = json_encode($content);
$result = (new Request())->Request($conf['url'],$Message);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Message/System/System.php | RongCloud/Lib/Message/System/System.php | <?php
/**
* system message
*/
namespace RongCloud\Lib\Message\System;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class System
{
/**
* @var string System message path
*/
private $jsonPath = 'Lib/Message/System/';
/**
* Request configuration file
*
* @var string
*
*/
private $conf = '';
/**
* Configuration file for validation
*
* @var string
*/
private $verify = '';
/**
* System constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath . 'api.json');
$this->verify = Utils::getJson($this->jsonPath . '../verify.json');;
}
/**
* @param array $Message System message delivery
* @param
* $Message = [
* 'senderId'=> '__system__',//Sender ID
* 'targetId'=> 'markoiwm',//Receiver ID
* "objectName"=>'RC:TxtMsg',//Message type Text
* 'content'=>['content'=>'Hello, Xiao Ming']//Message Body
* ];
* @return array
*/
public function send(array $Message = [])
{
$conf = $this->conf['send'];
if (isset($Message['content'])) {
$Message['content'] = json_encode($Message['content']);
}
$error = (new Utils())->check([
'api' => $conf,
'model' => 'message',
'data' => $Message,
'verify' => $this->verify['message']
]);
if ($error) return $error;
$Message = (new Utils())->rename($Message, [
'senderId' => 'fromUserId',
'targetId' => 'toUserId'
]);
$result = (new Request())->Request($conf['url'], $Message);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* @param array $Message Push-only Notification
* @param
* $Message = [
* 'userIds'=> ["user1","user2"],//Receiver ID
* 'notification'=> [
* "title"=>"Title",
* "pushContent"=>"this is a push",
* "ios"=>
* [
* "thread-id"=>"223",
* "apns-collapse-id"=>"111",
* "extras"=> ["id"=>"1","name"=>"2"]
* ],
* "android"=> [
* "hw"=>[
* "channelId"=>"NotificationKanong",
* "importance"=> "NORMAL",
* "image"=>"https://example.com/image.png"
* ],
* "mi"=>[
* "channelId"=>"rongcloud_kanong",
* "large_icon_uri"=>"https=>//example.com/image.png"
* ],
* "oppo"=>[
* "channelId"=>"rc_notification_id"
* ],
* "vivo"=>[
* "classification"=>"0"
* ],
* "extras"=> ["id"=> "1","name"=> "2"]
* ]
* ]
* ];
* @return array
*/
public function pushUser(array $Message = [])
{
$conf = $this->conf['pushUser'];
$error = (new Utils())->check([
'api' => $conf,
'model' => 'message',
'data' => $Message,
'verify' => $this->verify['pushUser']
]);
if ($error) return $error;
$result = (new Request())->Request($conf['url'], $Message, "json");
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* @param array $Message System broadcast message
* @param
* $Message = [
* 'senderId'=> '__system__',//Sender ID
* "objectName"=>'RC:TxtMsg',//Message type
* 'content'=>['content'=>'Hello, Xiao Ming']//Message content
* ];
* @return array
*/
public function broadcast(array $Message = [])
{
$conf = $this->conf['broadcast'];
if (isset($Message['content'])) {
$Message['content'] = json_encode($Message['content']);
}
$verify = $this->verify['broadcast'];
if (isset($verify['targetId'])) {
unset($verify['targetId']);
}
$error = (new Utils())->check([
'api' => $conf,
'model' => 'message',
'data' => $Message,
'verify' => $verify
]);
if ($error) return $error;
$Message = (new Utils())->rename($Message, [
'senderId' => 'fromUserId',
]);
$result = (new Request())->Request($conf['url'], $Message);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Broadcast to online users
*
* @param array $Message
* @param
* $Message = [
* 'senderId'=> '__system__',//Sender ID
* "objectName"=>'RC:TxtMsg',//Message type
* 'content'=>['content'=>'Hello, Xiaoming']//Message content
* ];
* @return array
*/
public function onlineBroadcast(array $Message = [])
{
$conf = $this->conf['onlineBroadcast'];
if (isset($Message['content'])) {
$Message['content'] = json_encode($Message['content']);
}
$verify = $this->verify['broadcast'];
if (isset($verify['targetId'])) {
unset($verify['targetId']);
}
$error = (new Utils())->check([
'api' => $conf,
'model' => 'message',
'data' => $Message,
'verify' => $verify
]);
if ($error) return $error;
$Message = (new Utils())->rename($Message, [
'senderId' => 'fromUserId',
]);
$result = (new Request())->Request($conf['url'], $Message);
$bodyParameter = (new Request())->getQueryFields($Message);
$result = (new Utils())->responseError($result, $conf['response']['fail'], $bodyParameter);
return $result;
}
/**
* @param array $Message System template message
* @param
* $Message = [
* 'senderId'=> '__system__', // Sender ID
* 'objectName'=>'RC:TxtMsg', // Message type: Text
* 'template'=>['content'=>'{name}, language score {score} points'], // Template content
* 'content'=>[
* 'sea9901'=>[ // Recipient ID
* 'data'=>['{name}'=>'Xiao Ming','{score}'=>'90'], // Template data
* 'push'=>'{name} your score is out', // Push notification content
* ],
* 'sea9902'=>[ // Recipient ID
* 'data'=>['{name}'=>'Xiao Hong','{score}'=>'95'], // Template data
* 'push'=>'{name} your score is out', // Push notification content
* ]
* ]
* ];
* @return array
*/
public function sendTemplate(array $Message = [])
{
$conf = $this->conf['sendTemplate'];
$error = (new Utils())->check([
'api' => $conf,
'model' => 'message',
'data' => $Message,
'verify' => $this->verify['tplMsg']
]);
if ($error) return $error;
$Message = (new Utils())->rename($Message, [
'senderId' => 'fromUserId',
]);
$Message['content'] = isset($Message['content']) ? json_decode($Message['content'], true) : [];
$newMessage = [
'fromUserId' => $Message['fromUserId'],
'objectName' => $Message['objectName'],
"content" => $Message['template'],
];
foreach ($Message['content'] as $userId => $v) {
$newMessage['toUserId'][] = $userId;
$newMessage['values'][] = $v['data'];
$newMessage['pushData'][] = isset($v['pushData']) ? $v['pushData'] : '';
$newMessage['pushContent'][] = $v['push'];
}
$result = (new Request())->Request($conf['url'], $newMessage, 'json');
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
}
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Entrust/Entrust.php | RongCloud/Lib/Entrust/Entrust.php | <?php
/**
* Information Hosting Module
*/
namespace RongCloud\Lib\Entrust;
use RongCloud\Lib\Entrust\Group\Group;
use RongCloud\Lib\Entrust\Group\RemarkName\RemarkName;
use RongCloud\Lib\Entrust\Group\Member\Member;
use RongCloud\Lib\Entrust\Group\Manager\Manager;
use RongCloud\Lib\Utils;
use RongCloud\Lib\Request;
class Entrust
{
/**
* Information Hosting Module Path
*
* @var string
*/
private $jsonPath = 'Lib/Entrust/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file for validation
*
* @var string
*/
private $verify = '';
/**
* User constructor.
*/
function __construct()
{
// Initialize request configuration and validate file path
$this->conf = Utils::getJson($this->jsonPath . 'api.json');
$this->verify = Utils::getJson($this->jsonPath . 'verify.json');
}
/**
* Group information module
*
* @return Group
*/
public function Group()
{
return new Group();
}
/**
* Group information management module
*
* @return Manager
*/
public function GroupManager()
{
return new Manager();
}
/**
* Group information management - remark name module
*
* @return RemarkName
*/
public function GroupRemarkName()
{
return new RemarkName();
}
/**
* Group information trustee - member module
*
* @return Member
*/
public function GroupMember()
{
return new Member();
}
}
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Entrust/Group/Group.php | RongCloud/Lib/Entrust/Group/Group.php | <?php
/**
* Group Information Management Module
*/
namespace RongCloud\Lib\Entrust\Group;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Group
{
/**
* Information hosting module path
*
* @var string
*/
private $jsonPath = 'Lib/Entrust/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Validate configuration file
*
* @var string
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath . 'api.json');
$this->verify = Utils::getJson($this->jsonPath . 'verify.json');
}
/**
* Create Group
*
* @param array $param = [
* 'groupId' => '111',
* 'name' => 'name123',
* 'owner' => 'admin',
* 'userIds' => ['123','456'],
* 'groupProfile' => ['introduction'=>'','announcement'=>'','portraitUrl'=>''],
* 'permissions' => ['joinPerm'=>0,'removePerm'=>0,'memInvitePerm'=>0,'invitePerm'=>0,'profilePerm'=>0,'memProfilePerm'=>0],
* 'groupExtProfile' => ['key'=>'value']
* ]
* @return array
*/
public function create(array $param = [])
{
$modelName = 'create';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
if (isset($param['groupProfile']) && is_array($param['groupProfile'])) {
$param['groupProfile'] = json_encode($param['groupProfile'], JSON_UNESCAPED_UNICODE);
}
if (isset($param['permissions']) && is_array($param['permissions'])) {
$param['permissions'] = json_encode($param['permissions'], JSON_UNESCAPED_UNICODE);
}
if (isset($param['groupExtProfile']) && is_array($param['groupExtProfile'])) {
$param['groupExtProfile'] = json_encode($param['groupExtProfile'], JSON_UNESCAPED_UNICODE);
}
$result = (new Request())->Request('entrust/group/create', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Set group information
*
* @param array $param = [
* 'groupId' => '111',
* 'name' => 'name123',
* 'groupProfile' => ['introduction'=>'','announcement'=>'','portraitUrl'=>''],
* 'permissions' => ['joinPerm'=>0,'removePerm'=>0,'memInvitePerm'=>0,'invitePerm'=>0,'profilePerm'=>0,'memProfilePerm'=>0],
* 'groupExtProfile' => ['key'=>'value']
* ]
* @return array
*/
public function update(array $param = [])
{
$modelName = 'update';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
if (isset($param['groupProfile']) && is_array($param['groupProfile'])) {
$param['groupProfile'] = json_encode($param['groupProfile'], JSON_UNESCAPED_UNICODE);
}
if (isset($param['permissions']) && is_array($param['permissions'])) {
$param['permissions'] = json_encode($param['permissions'], JSON_UNESCAPED_UNICODE);
}
if (isset($param['groupExtProfile']) && is_array($param['groupExtProfile'])) {
$param['groupExtProfile'] = json_encode($param['groupExtProfile'], JSON_UNESCAPED_UNICODE);
}
$result = (new Request())->Request('entrust/group/profile/update', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Exit group
*
* @param array $param = [
* 'groupId' => '111',
* 'userIds' => ['123','456'],
* 'isDelBan' => 1,
* 'isDelWhite' => 1,
* 'isDelFollowed' => 1
* ]
* @return array
*/
public function quit(array $param = [])
{
$modelName = 'groupId_userIds';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/quit', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Disband group
*
* @param array $param = [
* 'groupId' => '111'
* ]
* @return array
*/
public function dismiss(array $param = [])
{
$modelName = 'groupId';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/dismiss', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Join group
*
* @param array $param = [
* 'groupId' => '111',
* 'userIds' => ['123','456']
* ]
* @return array
*/
public function join(array $param = [])
{
$modelName = 'groupId_userIds';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/join', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Transfer group
*
* @param array $param = [
* 'groupId' => '111',
* 'newOwner' => '222',
* 'isQuit' => 0,
* 'isDelBan' => 1,
* 'isDelWhite' => 1,
* 'isDelFollowed' => 1
* ]
* @return array
*/
public function transferOwner(array $param = [])
{
$modelName = 'transferOwner';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/transfer/owner', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Group management import
*
* @param array $param = [
* 'groupId' => '111',
* 'name' => '222',
* 'owner' => '222',
* 'groupProfile' => ['introduction'=>'','announcement'=>'','portraitUrl'=>''],
* 'permissions' => ['joinPerm'=>0,'removePerm'=>0,'memInvitePerm'=>0,'invitePerm'=>0,'profilePerm'=>0,'memProfilePerm'=>0],
* 'groupExtProfile' => ['key'=>'value']
* ]
* @return array
*/
public function import(array $param = [])
{
$modelName = 'create';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
if (isset($param['groupProfile']) && is_array($param['groupProfile'])) {
$param['groupProfile'] = json_encode($param['groupProfile'], JSON_UNESCAPED_UNICODE);
}
if (isset($param['permissions']) && is_array($param['permissions'])) {
$param['permissions'] = json_encode($param['permissions'], JSON_UNESCAPED_UNICODE);
}
if (isset($param['groupExtProfile']) && is_array($param['groupExtProfile'])) {
$param['groupExtProfile'] = json_encode($param['groupExtProfile'], JSON_UNESCAPED_UNICODE);
}
$result = (new Request())->Request('entrust/group/import', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Pagination query application group information
*
* @param array $param = [
* 'pageToken' => '',
* 'size' => 50,
* 'order' => 1
* ]
* @return array
*/
public function query(array $param = [])
{
$result = (new Request())->Request('entrust/group/query', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Paginated query for users added to a group
*
* @param array $param = [
* 'userId' => '10',
* 'role' => 0,
* 'pageToken' => 'xxxx',
* 'size' => 50,
* 'order' => 1
* ]
* @return array
*/
public function joinedQuery(array $param = [])
{
$modelName = 'joinedQuery';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/joined/group/query', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Batch query group information
*
* @param array $param = [
* 'groupIds' => ['123','456'],
* ]
* @return array
*/
public function profileQuery(array $param = [])
{
$modelName = 'profileQuery';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/profile/query', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
}
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Entrust/Group/Member/Member.php | RongCloud/Lib/Entrust/Group/Member/Member.php | <?php
/**
* Group Information Management - Member Module
*/
namespace RongCloud\Lib\Entrust\Group\Member;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Member
{
/**
* Information hosting module path
*
* @var string
*/
private $jsonPath = 'Lib/Entrust/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file for verification
*
* @var string
*
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'verify.json');
}
/**
* Set group member information
*
* @param array $param = [
* 'groupId' => '111',
* 'userId' => '222',
* 'nickname' => 'rongcloud',
* 'extra' => 'xxxxxx'
* ]
* @return array
*/
public function set(array $param = [])
{
$error = (new Utils())->check([
'api' => $this->conf['member'],
'fail' => $this->conf['response']['fail'],
'model' => 'set',
'verify' => $this->verify['memberSet'],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/member/set', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Remove from group
*
* @param array $param = [
* 'groupId' => '111',
* 'userIds' => ['123','456'],
* 'isDelBan' => 1,
* 'isDelWhite' => 1,
* 'isDelFollowed' => 1
* ]
* @return array
*/
public function kick(array $param = [])
{
$modelName = 'groupId_userIds';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/member/kick', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Specify the user to exit all groups
*
* @param array $param = [
* 'userId' => '111'
* ]
* @return array
*/
public function kickAll(array $param = [])
{
$modelName = 'kickAll';
$error = (new Utils())->check([
'api' => $this->conf['member'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/member/kick/all', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Set user-specified group to follow particular users
*
* @param array $param = [
* 'groupId' => '111',
* 'userId' => '222',
* 'followUserIds' => ['111','222']
* ]
* @return array
*/
public function follow(array $param = [])
{
$error = (new Utils())->check([
'api' => $this->conf['member'],
'fail' => $this->conf['response']['fail'],
'model' => 'follow',
'verify' => $this->verify['memberFollow'],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/member/follow', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Delete the specified special follow users in the user-defined group
*
* @param array $param = [
* 'groupId' => '111',
* 'userId' => '222',
* 'followUserIds' => ['111','222']
* ]
* @return array
*/
public function unFollow(array $param = [])
{
$error = (new Utils())->check([
'api' => $this->conf['member'],
'fail' => $this->conf['response']['fail'],
'model' => 'follow',
'verify' => $this->verify['memberFollow'],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/member/unfollow', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Query the list of members with special attention in the user-specified group
*
* @param array $param = [
* 'groupId' => '111',
* 'userId' => '222'
* ]
* @return array
*/
public function getFollowed(array $param = [])
{
$modelName = 'groupId_userId';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/member/followed/get', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Get paginated member information
*
* @param array $param = [
* 'groupId' => '111',
* 'type' => 0,
* 'pageToken' => '',
* 'size' => 50,
* 'order' => 1
* ]
* @return array
*/
public function query(array $param = [])
{
$modelName = 'groupId';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/member/query', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Retrieve specified group member information
*
* @param array $param = [
* 'groupId' => '111',
* 'userIds' => ['123','456']
* ]
* @return array
*/
public function specificQuery(array $param = [])
{
$modelName = 'groupId_userIds';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/member/specific/query', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Entrust/Group/RemarkName/RemarkName.php | RongCloud/Lib/Entrust/Group/RemarkName/RemarkName.php | <?php
/**
* Group Information Hosting - Backup Naming Module
*/
namespace RongCloud\Lib\Entrust\Group\RemarkName;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class RemarkName
{
/**
* Information hosting module path
*
* @var string
*/
private $jsonPath = 'Lib/Entrust/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file validation
*
* @var string
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'verify.json');
}
/**
* Set the user-specified group name remark
*
* @param array $param = [
* 'groupId' => '111',
* 'userId' => '222',
* 'remarkName' => 'rongcloud'
* ]
* @return array
*/
public function set(array $param = [])
{
$error = (new Utils())->check([
'api' => $this->conf['remarkName'],
'fail' => $this->conf['response']['fail'],
'model' => 'set',
'verify' => $this->verify['remarkNameSet'],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/remarkname/set', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Delete the specified group name annotation for the user
*
* @param array $param = [
* 'groupId' => '111',
* 'userId' => '222'
* ]
* @return array
*/
public function delete(array $param = [])
{
$modelName = 'groupId_userId';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/remarkname/delete', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Query the specified group name for user remarks
*
* @param array $param = [
* 'groupId' => '111',
* 'userId' => '222'
* ]
* @return array
*/
public function query(array $param = [])
{
$modelName = 'groupId_userId';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/remarkname/query', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Entrust/Group/Manager/Manager.php | RongCloud/Lib/Entrust/Group/Manager/Manager.php | <?php
/**
* Group Information Trusteeship - Management Module
*/
namespace RongCloud\Lib\Entrust\Group\Manager;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Manager
{
/**
* Information hosting module path
*
* @var string
*/
private $jsonPath = 'Lib/Entrust/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file for validation
*
* @var string
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'verify.json');
}
/**
* Set group administrator (add group administrator)
*
* @param array $param = [
* 'groupId' => '111',
* 'userIds' => ['123','456']
* ]
* @return array
*/
public function add(array $param = [])
{
$modelName = 'groupId_userIds';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/manager/add', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
/**
* Remove group administrator
*
* @param array $param = [
* 'groupId' => '111',
* 'userIds' => ['123','456']
* ]
* @return array
*/
public function remove(array $param = [])
{
$modelName = 'groupId_userIds';
$error = (new Utils())->check([
'api' => $this->conf['group'],
'fail' => $this->conf['response']['fail'],
'model' => $modelName,
'verify' => $this->verify[$modelName],
'data' => $param
]);
if ($error) {
return $error;
}
$result = (new Request())->Request('entrust/group/manager/remove', $param);
$result = (new Utils())->responseError($result, $this->conf['response']['fail']);
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Conversation/Conversation.php | RongCloud/Lib/Conversation/Conversation.php | <?php
/**
* Conversation Module
* conversation=> hejinyu
* Date=> 2018/7/23
* Time=> 11=>41
*/
namespace RongCloud\Lib\Conversation;
use RongCloud\Lib\ConversationType;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Conversation
{
/**
* Session module path
*
* @var string
*/
private $jsonPath = 'Lib/Conversation/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file for validation
*
* @var string
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath . 'api.json');
$this->verify = Utils::getJson($this->jsonPath . 'verify.json');
}
/**
* Screen Session Push
*
* @param array $Conversation Screen session push parameters
* @param
* $Conversation = [
* 'type'=> 'PRIVATE',//Session type: PRIVATE, GROUP, DISCUSSION, SYSTEM
* 'userId'=>'mka091amn',//Session owner
* 'targetId'=>'adm1klnm'//Session ID
* ];
* @return array
*/
public function mute(array $Conversation = [])
{
$conf = $this->conf['mute'];
$error = (new Utils())->check([
'api' => $conf,
'model' => 'conversation',
'data' => $Conversation,
'verify' => $this->verify['conversation']
]);
if ($error) return $error;
$Conversation['type'] = ConversationType::t()[$Conversation['type']];
$Conversation['isMuted'] = 1;
$Conversation = (new Utils())->rename($Conversation, [
'type' => 'conversationType',
'userId' => 'requestId'
]);
$result = (new Request())->Request($conf['url'], $Conversation);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Receive Conversation Push
*
* @param array $Conversation Parameters for receiving Conversation Push
* @param
* $Conversation = [
* 'type'=> 'PRIVATE',//Conversation type PRIVATE, GROUP, DISCUSSION, SYSTEM
* 'userId'=>'mka091amn',//Conversation owner
* 'targetId'=>'adm1klnm'//Conversation id
* ];
* @return array
*/
public function unmute(array $Conversation = [])
{
$conf = $this->conf['mute'];
$error = (new Utils())->check([
'api' => $conf,
'model' => 'conversation',
'data' => $Conversation,
'verify' => $this->verify['conversation']
]);
if ($error) return $error;
$Conversation['type'] = ConversationType::t()[$Conversation['type']];
$Conversation['isMuted'] = 0;
$Conversation = (new Utils())->rename($Conversation, [
'type' => 'conversationType',
'userId' => 'requestId'
]);
$result = (new Request())->Request($conf['url'], $Conversation);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get the conversation state without interruption
*
* @param array $Conversation Receive conversation Push parameters
* @param
* $Conversation = [
* 'type'=> 'PRIVATE',// Conversation type PRIVATE, GROUP, DISCUSSION, SYSTEM
* 'userId'=>'mka091amn',// Conversation owner
* 'targetId'=>'adm1klnm'// Conversation id
* ];
* @return array
*/
public function get(array $Conversation = [])
{
$conf = $this->conf['mute'];
$error = (new Utils())->check([
'api' => $conf,
'model' => 'conversation',
'data' => $Conversation,
'verify' => $this->verify['conversation']
]);
if ($error) return $error;
$Conversation['type'] = ConversationType::t()[$Conversation['type']];
$Conversation['isMuted'] = 0;
$Conversation = (new Utils())->rename($Conversation, [
'type' => 'conversationType',
'userId' => 'requestId'
]);
$result = (new Request())->Request($conf['url'], $Conversation);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Pin Conversation
*
* @param array
* $Conversation = [
* 'userId'=>'mka091amn',// User ID, the user to whom the conversation belongs
* 'conversationType'=>'1',// Conversation type. Supported conversation types include: 1 (one-to-one chat), 3 (group chat), 6 (system conversation).
* 'targetId'=>'adm1klnd',// Target ID to be set, which varies depending on the conversation type: user ID for one-to-one chat, group ID for group chat, or system target ID.
* 'setTop'=>'true'// true means pin, false means unpin.
* ];
* @return void
*/
public function pinned(array $Conversation = [])
{
$conf = $this->conf['pinned'];
$error = (new Utils())->check([
'api' => $conf,
'model' => 'pinned',
'data' => $Conversation,
'verify' => $this->verify['pinned']
]);
if ($error) return $error;
$result = (new Request())->Request($conf['url'], $Conversation);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
}
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Chatroom.php | RongCloud/Lib/Chatroom/Chatroom.php | <?php
/**
* Chatroom
*/
namespace RongCloud\Lib\Chatroom;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
use RongCloud\Lib\Chatroom\Ban\Ban;
use RongCloud\Lib\Chatroom\Block\Block;
use RongCloud\Lib\Chatroom\Demotion\Demotion;
use RongCloud\Lib\Chatroom\Distribute\Distribute;
use RongCloud\Lib\Chatroom\Gag\Gag;
use RongCloud\Lib\Chatroom\Keepalive\Keepalive;
use RongCloud\Lib\Chatroom\Whitelist\Whitelist;
use RongCloud\Lib\Chatroom\Whitelist\Message;
use RongCloud\Lib\Chatroom\Entry\Entry;
use RongCloud\Lib\Chatroom\MuteAllMembers\MuteAllMembers;
use RongCloud\Lib\Chatroom\MuteWhiteList\MuteWhiteList;
class Chatroom
{
/**
* Chat room module path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Validation configuration file
*
* @var string
*/
private $verify = '';
/**
* Chatroom constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'verify.json');
}
/**
* Chatroom Creation
*
* @deprecated Deprecated, please use the createV2 method for creation
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'chatroom9992',//Chatroom ID
* 'name'=> 'RongCloud',//Chatroom name
* ];
* @return mixed|null
*/
public function create(array $Chatroom=[]){
if(!isset($Chatroom[0])){
$Chatroom = [$Chatroom];
}
$conf = $this->conf['create'];
$verify = $this->verify['chatroom'];
$verify = ['id'=>$verify['id'],'name'=>$verify['name']];
$data = [];
foreach ($Chatroom as $v){
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $v,
'verify'=> $verify
]);
if($error) return $error;
$data["chatroom[{$v['id']}]"] = $v['name'];
}
$result = (new Request())->Request($conf['url'],$data);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Chatroom Creation
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'chatroom9992',// Chatroom ID
* 'destroyType' => 0,// Specifies the destruction type of the chatroom 0: Default value, indicates destruction when inactive, 1: Fixed time destruction
* 'destroyTime' => 60,// Sets the destruction time of the chatroom
* 'isBan' => false,// Whether to ban all members of the chatroom, default false
* 'whiteUserIds' => ['user1','user2'],// Whitelist user list for banning, supports batch setting, maximum not exceeding 20
* 'entryOwnerId' => '',// The owner user ID of the chatroom's custom properties.
* 'entryInfo' => '',// Custom properties KV pair of the chatroom, JSON structure.
* ];
* @return mixed|null
*/
public function createV2(array $Chatroom=[]){
$conf = $this->conf['createV2'];
$verify = $this->verify['chatroom'];
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=> 'chatroomId',
]);
$result = (new Request())->Request($conf['url'], $Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Set chatroom destruction type
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'chatroom9992', //Chatroom id
* 'destroyType'=> 0, //Specifies the destruction method of the chatroom.
* 'destroyTime'=> 60 //Set the destruction time of the chatroom.
* ];
* @return mixed|null
*/
public function setDestroyType(array $Chatroom=[]){
$conf = $this->conf['setDestroyType'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=> 'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Destroy chatroom
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'chatroom9992',//chatroom id
* ];
* @return mixed|null
*/
public function destory(array $Chatroom=[]){
$conf = $this->conf['destory'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=> 'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Query chatroom basic information
*
* @DateTime 2023-06-14
* @deprecated Deprecated, please use the queryV2 method for creation
* @param array $Chatroom ['id'=> ['chatroom1','chatroom1','chatroom1']]
*
* @return array
*/
public function query(array $Chatroom=[]){
$conf = $this->conf['query'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=> 'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Query chatroom basic information V2
*
* @DateTime 2023-10-08
* @param array $Chatroom ['id'=> ['chatroom1','chatroom1','chatroom1']]
*
* @return array
*/
public function queryV2(array $Chatroom=[]){
$conf = $this->conf['queryV2'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=> 'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get chatroom members
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'chatroom9992',// Chatroom ID
* 'count'=>10,// Number of chatroom members, maximum return 500 members
* 'order'=>2// Query order of chatroom members, 1: Join time ascending 2: Join time descending
* ];
* @return mixed|null
*/
public function get(array $Chatroom=[]){
$conf = $this->conf['get'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=> 'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Check if the user is in the chatroom
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'chatroom9992',// Chatroom ID
* 'members'=>[
* ['id'=>"sea9902"]// Member ID
* ]
* ];
* @return mixed|null
*/
public function isExist(array $Chatroom=[]){
$conf = $this->conf['isExist'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id'],'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=> 'chatroomId',
'members'=>'userId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
if($result['code'] == 200){
$result = (new Utils())->rename($result,['result'=>'members']);
foreach ($result['members'] as $k=>&$v){
$v = (new Utils())->rename($v,['userId'=>'id']);
}
}
return $result;
}
/**
* Create a global mute object for the chat room
*
* @return MuteWhiteList
*/
public function Ban(){
return new Ban();
}
/**
* Create a chat room block object
*
* @return Block
*/
public function Block(){
return new Block();
}
/**
* Create a chat room message demotion object
*
* @return Demotion
*/
public function Demotion(){
return new Demotion();
}
/**
* Create a chat room message distribution object
*
* @return Distribute
*/
public function Distribute(){
return new Distribute();
}
/**
* Create a chat room member gag object
*
* @return Gag
*/
public function Gag(){
return new Gag();
}
/**
* Create a chat room keepalive object
*
* @return Keepalive
*/
public function Keepalive(){
return new Keepalive();
}
/**
* Create a chat room user whitelist object
*
* @return Whitelist
*/
public function Whitelist(){
return new Whitelist();
}
/**
* Create a chat room whitelist message object
*
* @return Message
*/
public function Message(){
return new Message();
}
/**
* Create a whitelist message object for the chat room
*
* @return Entry
*/
public function Entry(){
return new Entry();
}
/**
* Mute all members in the chat room
*
* @return MuteAllMembers
*/
public function MuteAllMembers(){
return new MuteAllMembers();
}
/**
* Chat room global mute whitelist
*
* @return MuteWhiteList
*/
public function MuteWhiteList(){
return new MuteWhiteList();
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/MuteAllMembers/MuteAllMembers.php | RongCloud/Lib/Chatroom/MuteAllMembers/MuteAllMembers.php | <?php
/**
* Global mute in the chat room
*/
namespace RongCloud\Lib\Chatroom\MuteAllMembers;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class MuteAllMembers {
/**
* Chat room global mute path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/MuteAllMembers/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Verify configuration file
*
* @var string
*/
private $verify = '';
/**
* MuteAllMembers constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Add a global mute for the chatroom
*
* @param array $Chatroom
* $Chatroom = [
* ['id'=>'seal9901']//chatroom id
* ];
* @return mixed|null
*/
public function add(array $Chatroom=[]){
$conf = $this->conf['add'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Remove global ban
*
* @param array $Chatroom
* $Chatroom = [
* ['id'=>'seal9901']//chatroom id
* ];
* @return mixed|null
*/
public function remove(array $Chatroom=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Global ban status check
*
* @param array $Chatroom
* $Chatroom = [
* ['id'=>'seal9901']//chatroom id
* ];
* @return mixed|null
*/
public function check(array $Chatroom=[]){
$conf = $this->conf['check'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get the list of global mute status for the chatroom
*
* @param array $Chatroom
* $Chatroom = [
*
* ];
* @return mixed|null
*/
public function getList($page = 1, $size = 50){
$conf = $this->conf['getList'];
$Chatroom = ["page"=>$page, "size"=>$size];
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/MuteWhiteList/MuteWhiteList.php | RongCloud/Lib/Chatroom/MuteWhiteList/MuteWhiteList.php | <?php
/**
* Global chat room ban
*/
namespace RongCloud\Lib\Chatroom\MuteWhiteList;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class MuteWhiteList {
/**
* Chatroom global mute path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/MuteWhiteList/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file for validation
*
* @var string
*/
private $verify = '';
/**
* MuteWhiteList constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Add a chatroom-wide mute whitelist
*
* @param array $Chatroom
* $Chatroom = [
* 'members'=> [
* ['id'=>'seal9901']// member id
* ],
* 'id'=>"chatroomId"// chatroom id
* ];
* @return mixed|null
*/
public function add(array $Chatroom=[]){
$conf = $this->conf['add'];
$verify = $this->verify['chatroom'] ;
$verify = ['members'=>$verify['members'],'id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'members'=>'userId',
'id'=>"chatroomId"
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Remove all banned members from the chatroom
*
* @param array $Chatroom
* $Chatroom = [
* 'members'=> [
* ['id'=>'seal9901']//member id
* ],
* 'id'=>"chatroomId"//chatroom id
* ];
* @return mixed|null
*/
public function remove(array $Chatroom=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['chatroom'] ;
$verify = ['members'=>$verify['members'],"id"=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'members'=>'userId',
'id'=>"chatroomId"
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get the chatroom's global ban whitelist
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=>"chatroomId"//Chatroom ID
* ];
* @return mixed|null
*/
public function getList(array $Chatroom=[]){
$conf = $this->conf['getList'];
$verify = $this->verify['chatroom'] ;
$verify = ["id"=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>"chatroomId"
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Block/Block.php | RongCloud/Lib/Chatroom/Block/Block.php | <?php
/**
* Chat room ban
*/
namespace RongCloud\Lib\Chatroom\Block;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Block {
/**
* Chat room ban path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/Block/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file for validation
*
* @var string
*/
private $verify = '';
/**
* Block constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Add ban
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',// Chatroom ID
* 'members'=> [
* ['id'=>'seal9901']// Banned member ID
* ],
* 'minute'=>30// Ban duration in minutes
* ];
* @return mixed|null
*/
public function add(array $Chatroom=[]){
$conf = $this->conf['add'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id'],'members'=>$verify['members'],'minute'=>$verify['minute']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=> 'chatroomId',
'members'=>'userId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Unblock
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',//Chatroom ID
* 'members'=> [
* ['id'=>'seal9901']//Unblocked member ID
* ],
* ];
* @return mixed|null
*/
public function remove(array $Chatroom=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id'],'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=> 'chatroomId',
'members'=>'userId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Query the list of banned members
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'chatroom9992',//chatroom id
* ];
* @return mixed|null
*/
public function getList(array $Chatroom=[]){
$conf = $this->conf['getList'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=> 'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
if($result['code'] == 200){
$result = (new Utils())->rename($result,['users'=>'members']);
foreach ($result['members'] as $k=>&$v){
$v = (new Utils())->rename($v,['userId'=>'id']);
}
}
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Gag/Gag.php | RongCloud/Lib/Chatroom/Gag/Gag.php | <?php
/**
* Chatroom member ban speech
*/
namespace RongCloud\Lib\Chatroom\Gag;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Gag {
/**
* Chatroom member ban path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/Gag/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Verify configuration file
*
* @var string
*/
private $verify = '';
/**
* Gag constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Add member mute
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',// Chatroom ID
* 'members'=> [
* ['id'=>'seal9901']// Muted member ID
* ],
* 'minute'=>30// Mute duration in minutes
* ];
* @return mixed|null
*/
public function add(array $Chatroom=[]){
$conf = $this->conf['add'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id'],'members'=>$verify['members'],'minute'=>$verify['minute']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'members'=>'userId',
'id'=>'chatroomId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Unmute chatroom members
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',//Chatroom id
* 'members'=> [
* ['id'=>'seal9901']//Member id
* ]
* ];
* @return mixed|null
*/
public function remove(array $Chatroom=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id'],'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId',
'members'=>'userId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get the list of banned members in a chatroom
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',//chatroom id
* ];
* @return mixed|null
*/
public function getList(array $Chatroom=[]){
$conf = $this->conf['getList'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
if($result['code'] == 200){
$result = (new Utils())->rename($result,['users'=>'members']);
foreach ($result['members'] as $k=>&$v){
$v = (new Utils())->rename($v,['userId'=>'id']);
}
}
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Ban/Ban.php | RongCloud/Lib/Chatroom/Ban/Ban.php | <?php
/**
* Mute all chatrooms
*/
namespace RongCloud\Lib\Chatroom\Ban;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Ban {
/**
* Global forbidden words path for chat room
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/Ban/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Validation configuration file
*
* @var string
*/
private $verify = '';
/**
* Ban constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Add a global mute for the chatroom
*
* @param array $Chatroom
* $Chatroom = [
* 'members'=> [
* ['id'=>'seal9901']//member id
* ],
* 'minute'=>30//mute duration
* ];
* @return mixed|null
*/
public function add(array $Chatroom=[]){
$conf = $this->conf['add'];
$verify = $this->verify['chatroom'] ;
$verify = ['members'=>$verify['members'],'minute'=>$verify['minute']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'members'=>'userId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get the global banned words list of the chatroom
*
* @param array $Chatroom
* $Chatroom = [
* 'members'=> [
* ['id'=>'seal9901']// Member ID
* ]
* ];
* @return mixed|null
*/
public function remove(array $Chatroom=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['chatroom'] ;
$verify = ['members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'members'=>'userId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Add ban
*
* @param array $Chatroom
* $Chatroom = [
*
* ];
* @return mixed|null
*/
public function getList(array $Chatroom=[]){
$conf = $this->conf['getList'];
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
if($result['code'] == 200){
$result = (new Utils())->rename($result,['users'=>'members']);
foreach ($result['members'] as $k=>&$v){
$v = (new Utils())->rename($v,['userId'=>'id']);
}
}
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Keepalive/Keepalive.php | RongCloud/Lib/Chatroom/Keepalive/Keepalive.php | <?php
/**
* Chatroom Keepalive
*/
namespace RongCloud\Lib\Chatroom\Keepalive;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Keepalive {
/**
* Chat room keep-alive path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/Keepalive/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Verify configuration file
*
* @var string
*/
private $verify = '';
/**
* Keepalive constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Add a chatroom for live chat
*
* @param $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',// chatroom id
* ];
* @return mixed|null
*/
public function add(array $Chatroom=[]){
$conf = $this->conf['add'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Delete chatroom
*
* @param $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',//chatroom id
* ];
* @return mixed|null
*/
public function remove(array $Chatroom=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get the chatroom for preserving
*
* @param $Chatroom
* $Chatroom = [
*
* ];
* @return mixed|null
*/
public function getList(array $Chatroom=[]){
$conf = $this->conf['getList'];
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
if($result['code'] == 200 || $result['code'] == 0){
$result = (new Utils())->rename($result,['chatroomIds'=>'chatrooms']);
$result['code'] = 200;
}
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Distribute/Distribute.php | RongCloud/Lib/Chatroom/Distribute/Distribute.php | <?php
/**
* Chat room message distribution
*/
namespace RongCloud\Lib\Chatroom\Distribute;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Distribute {
/**
* Stop the chat room message distribution path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/Distribute/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file for verification
*
* @var string
* Configuration file for verification
*
* @var string
*
*/
private $verify = '';
/**
* Distribute constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Stop chatroom message distribution
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',//chatroom id
* ];
* @return mixed|null
*/
public function stop(array $Chatroom=[]){
$conf = $this->conf['stop'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Restore chatroom message distribution
*
* @param array $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',//chatroom id
* ];
* @return mixed|null
*/
public function resume(array $Chatroom=[]){
$conf = $this->conf['resume'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Whitelist/User.php | RongCloud/Lib/Chatroom/Whitelist/User.php | <?php
/**
* Chat room user whitelist
*/
namespace RongCloud\Lib\Chatroom\Whitelist;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class User {
/**
* Chat room whitelist user module path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/Whitelist/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Configuration file for verification
*
* @var string
*/
private $verify = '';
/**
* Keepalive constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'user-api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Add chatroom user whitelist
*
* @param $Chatroom
* $Chatroom = [
* 'id'=> "chatroom1",// Chatroom ID
* 'members'=>['abc','abcd']// User list
* ]
* @return array
*/
public function add(array $Chatroom=[]){
$conf = $this->conf['add'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id'],'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId',
'members'=>'userId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Remove chatroom user whitelist
*
* @param $Chatroom
* $Chatroom = [
* 'id'=> "chatroom1",//chatroom id
* 'members'=>['abc','abcd']//user list
* ]
* @return array
*/
public function remove(array $Chatroom=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id'],'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Chatroom['members'] as &$v){
$v = $v['id'];
}
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId',
'members'=>'userId'
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get the chatroom user whitelist
*
* @param $Chatroom
* $Chatroom = [
*
* ]
* @return array
*/
public function getList(array $Chatroom=[]){
$conf = $this->conf['getList'];
$verify = $this->verify['chatroom'] ;
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'id'=>'chatroomId',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
if($result['code'] == 200){
$result = (new Utils())->rename($result,['users'=>'members']);
foreach ($result['members'] as $k=>$v){
$result['members'][$k] = ['id'=>$v];
}
}
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Whitelist/Whitelist.php | RongCloud/Lib/Chatroom/Whitelist/Whitelist.php | <?php
/**
* Chatroom allowlist
*/
namespace RongCloud\Lib\Chatroom\Whitelist;
use RongCloud\Lib\Chatroom\Whitelist\User;
use RongCloud\Lib\Chatroom\Whitelist\Message;
class Whitelist {
/**
* Get the whitelist message object for LianTian
*
* @return Message
*/
public function Message(){
return new Message();
}
/**
* Get the User object for the whitelist user in LianTian
*
* @return User
*/
public function User(){
return new User();
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Whitelist/Message.php | RongCloud/Lib/Chatroom/Whitelist/Message.php | <?php
/**
* Chat room message whitelist
*/
namespace RongCloud\Lib\Chatroom\Whitelist;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Message {
/**
* Chat room message whitelist path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/Whitelist/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Verify configuration file
*
* @var string
*/
private $verify = '';
/**
* Message constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'message-api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Add chatroom message whitelist
*
* @param $Chatroom
* $Chatroom = [
* 'msgs'=> ["RC:TxtMsg"]//Message type list
* ]
* @return array
*/
public function add(array $Chatroom=[]){
$conf = $this->conf['add'];
$verify = $this->verify['demotion'] ;
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'msgs'=>'objectnames',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Delete chatroom message whitelist
*
* @param $Chatroom
* $Chatroom = [
* 'msgs'=> ["RC:TxtMsg"]//Message type list
* ]
* @return array
*/
public function remove(array $Chatroom=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['demotion'] ;
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'chatroom',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'msgs'=>'objectnames',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get the chatroom message whitelist
*
* @param $Chatroom
* $Chatroom = [
*
* ]
* @return array
*/
public function getList(array $Chatroom=[]){
$conf = $this->conf['getList'];
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
if($result['code'] == 200){
$result = (new Utils())->rename($result,['whitlistmsgType'=>'objectNames']);
}
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Demotion/Demotion.php | RongCloud/Lib/Chatroom/Demotion/Demotion.php | <?php
/**
* Chat room message downgrade
*/
namespace RongCloud\Lib\Chatroom\Demotion;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Demotion {
/**
* Chat room message degradation path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/Demotion/';
/**
* Request configuration file
*
* @var string
*
*/
private $conf = '';
/**
* Validation configuration file
*
* @var string
*/
private $verify = '';
/**
* Demotion constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');;
}
/**
* Add application in-chat room downgrade message
*
* @param array $Chatroom
* $Chatroom = [
* 'msgs'=> ['RC:TxtMsg03','RC:TxtMsg02']// Message type list
* ];
* @return mixed|null
*/
public function add(array $Chatroom=[]){
$conf = $this->conf['add'];
$verify = $this->verify['demotion'] ;
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'demotion',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'msgs'=>'objectName',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Remove in-app chatroom downgrade messages
*
* @param array $Chatroom
* $Chatroom = [
* 'msgs'=> ['RC:TxtMsg03','RC:TxtMsg02']// Message type list
* ];
* @return mixed|null
*/
public function remove(array $Chatroom=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['demotion'] ;
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'demotion',
'data'=> $Chatroom,
'verify'=> $verify
]);
if($error) return $error;
$Chatroom = (new Utils())->rename($Chatroom, [
'msgs'=>'objectName',
]);
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get the downgrade message of the in-app chatroom
*
* @param array $Chatroom
* $Chatroom = [
*
* ];
* @return mixed|null
*/
public function getList(array $Chatroom=[]){
$conf = $this->conf['getList'];
$result = (new Request())->Request($conf['url'],$Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Chatroom/Entry/Entry.php | RongCloud/Lib/Chatroom/Entry/Entry.php | <?php
/**
* Chat room attributes
*/
namespace RongCloud\Lib\Chatroom\Entry;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Entry {
/**
* Chat room attribute path
*
* @var string
*/
private $jsonPath = 'Lib/Chatroom/Entry/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Validate configuration file
*
* @var string
*/
private $verify = '';
/**
* Keepalive constructor.
*/
function __construct() {
$this->conf = Utils::getJson($this->jsonPath . 'api.json');
$this->verify = Utils::getJson($this->jsonPath . '../verify.json');;
}
/**
* Set chatroom properties (KV)
*
* @param $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',// Chatroom id
* 'userId'=> 'ujadk90ha',// Operator user Id
* 'key'=> 'ujadk90ha',// Chatroom property name
* 'value'=> 'ujadk90ha',// Corresponding value of the chatroom property
* ];
* @return mixed|null
*/
public function set(array $Chatroom = []) {
$conf = $this->conf['set'];
$verify = $this->verify['chatroom'];
$verify = ['id' => $verify['id']];
$error = (new Utils())->check(
[
'api' => $conf,
'model' => 'chatroom',
'data' => $Chatroom,
'verify' => $verify
]
);
if ($error) {
return $error;
}
$Chatroom = (new Utils())->rename($Chatroom, [
'id' => 'chatroomId',
]);
$result = (new Request())->Request($conf['url'], $Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Batch set chatroom properties (KV)
*
* @param $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha', // Chatroom ID
* 'autoDelete'=> 0, // Whether to delete this Key value after the user (entryOwnerId) exits the chatroom
* 'entryOwnerId'=> 'test', // The user ID to whom the chatroom's custom properties belong
* 'entryInfo'=> '{"key1":"value1","key2":"value2"}',// The value corresponding to the chatroom properties
* ];
* @return mixed|null
*/
public function batchSet(array $Chatroom = []) {
$conf = $this->conf['batchset'];
$verify = $this->verify['chatroom'];
$verify = ['id' => $verify['id']];
$error = (new Utils())->check(
[
'api' => $conf,
'model' => 'chatroom',
'data' => $Chatroom,
'verify' => $verify
]
);
if ($error) {
return $error;
}
$Chatroom = (new Utils())->rename($Chatroom, [
'id' => 'chatroomId',
]);
$result = (new Request())->Request($conf['url'], $Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get chatroom properties
*
* @param $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',//Chatroom id
* 'userId'=> 'ujadk90ha',//Operator user Id
* 'key'=> 'ujadk90ha',//Chatroom property name
* ];
* @return mixed|null
*/
public function remove(array $Chatroom = []) {
$conf = $this->conf['remove'];
$verify = $this->verify['chatroom'];
$verify = ['id' => $verify['id']];
$error = (new Utils())->check(
[
'api' => $conf,
'model' => 'chatroom',
'data' => $Chatroom,
'verify' => $verify
]
);
if ($error) {
return $error;
}
$Chatroom = (new Utils())->rename($Chatroom, [
'id' => 'chatroomId',
]);
$result = (new Request())->Request($conf['url'], $Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get chatroom properties
*
* @param $Chatroom
* $Chatroom = [
* 'id'=> 'ujadk90ha',//Chatroom ID
* 'keys'=> 'ujadk90ha',//Operator user ID
* ]
* @return array
*/
public function query(array $Chatroom = []) {
$conf = $this->conf['query'];
$verify = $this->verify['chatroom'];
$verify = ['id' => $verify['id']];
$error = (new Utils())->check(
[
'api' => $conf,
'model' => 'chatroom',
'data' => $Chatroom,
'verify' => $verify
]);
if ($error) {
return $error;
}
if (isset($Chatroom['keys']) && count($Chatroom['keys']) > 0) {
foreach ($Chatroom['keys'] as &$v) {
$v = $v['key'];
}
}
$Chatroom = (new Utils())->rename($Chatroom, [
'id' => 'chatroomId',
]);
$result = (new Request())->Request($conf['url'], $Chatroom);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
if ($result['code'] == 200) {
foreach ($result['keys'] as $k => $v) {
$result['keys'][$k] = ['key' => $v];
}
}
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Ultragroup/Ultragroup.php | RongCloud/Lib/Ultragroup/Ultragroup.php | <?php
/**
* Super cluster module
* @author hejinyu
*/
namespace RongCloud\Lib\Ultragroup;
use RongCloud\Lib\Ultragroup\Gag\Gag;
use RongCloud\Lib\Ultragroup\MuteAllMembers\MuteAllMembers;
use RongCloud\Lib\Ultragroup\MuteWhiteList\MuteWhiteList;
use RongCloud\Lib\Ultragroup\Expansion\Expansion;
use RongCloud\Lib\Ultragroup\BusChannel\BusChannel;
use RongCloud\Lib\Ultragroup\Notdisturb\Notdisturb;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Ultragroup
{
/**
* Super cluster module path
*
* @var string
*/
private $jsonPath = 'Lib/Ultragroup/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Verify configuration file
*
* @var string
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'verify.json');
}
/**
* Create a super group
*
* @param array $Group Parameters for creating a super group
* @param
* $Group = [
* 'id'=> 'watergroup1', // Super group ID
* 'name'=> 'watergroup', // Super group name
* ];
* @return array
*/
public function create(array $Group=[]){
$conf = $this->conf['create'];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $this->verify['group']
]);
if($error) return $error;
$Group['member'] = isset($Group['member']['id'])?$Group['member']['id']:"";
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'name'=> 'groupName',
'member'=> 'userId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Join a super group
*
* @param array $Group Parameters for joining a super group
* @param
* $Group = [
* 'id'=> 'watergroup', // Super group ID
* 'name'=>"watergroup", // Super group name
* 'member'=>['id'=> 'group999'], // Group member information
* ];
* @return array
*/
public function joins(array $Group=[]){
$conf = $this->conf['join'];
$verify = $this->verify['group'];
$verify = array_merge($verify,$this->verify['member']);
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group['member'] = isset($Group['member']['id'])?$Group['member']['id']:"";
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'member'=> 'userId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Exit super group
*
* @param array $Group Exit super group parameter
* @param
* $Group = [
* 'id'=> 'watergroup', // Super group id
* 'member'=>['id'=> 'group999'], // Group member information
* ];
* @return array
*/
public function quit(array $Group=[]){
$conf = $this->conf['quit'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id']];
$verify = array_merge($verify,$this->verify['member']);
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group['member'] = isset($Group['member']['id'])?$Group['member']['id']:"";
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'member'=> 'userId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Disband supergroup
*
* @param array $Group Disband supergroup parameter
* @param
* $Group = [
* 'id'=> 'watergroup',//supergroup id
* 'member'=>['id'=> 'group999'],//admin information
* ];
* @return array
*/
public function dismiss(array $Group=[]){
$conf = $this->conf['dis'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group['member'] = isset($Group['member']['id'])?$Group['member']['id']:"";
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Modify group information
*
* @param array $Group Modify group information parameters
* @param
* $Group = [
* 'id'=> 'watergroup',//Super group id
* 'name'=>"watergroup"//group name
* ];
* @return array
*/
public function update(array $Group=[]){
$conf = $this->conf['refresh'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'],'name'=>$verify['name']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'name'=> 'groupName',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Does the super member exist
*
* @param array $Group Modify group information parameter
* @param
* $Group = [
* 'id'=> 'watergroup',//Super group id
* 'member'=>"userId" //Member id
* ];
* @return array
*/
public function isExist(array $Group=[]){
$conf = $this->conf['isExist'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'],'member'=>$verify['member']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'member'=> 'userId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Create a super group gag object
*
* @return Gag
*/
public function Gag(){
return new Gag();
}
/**
* Create a specified supergroup member mute command
*
* @return MuteAllMembers
*/
public function MuteAllMembers(){
return new MuteAllMembers();
}
/**
* Create a mute for all members of the specified supergroup
*
* @return MuteWhiteList
*/
public function MuteWhiteList(){
return new MuteWhiteList();
}
/**
* Super Group Expansion
*
* @return Expansion
*/
public function Expansion(){
return new Expansion();
}
/**
* Super Cluster Expansion
*
* @return BusChannel
*/
public function BusChannel(){
return new BusChannel();
}
/**
* Super group expansion does not disturb
*
* @return Notdisturb
*/
public function Notdisturb(){
return new Notdisturb();
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Ultragroup/MuteAllMembers/MuteAllMembers.php | RongCloud/Lib/Ultragroup/MuteAllMembers/MuteAllMembers.php | <?php
/**
* Specify a supergroup ban for all members
* @author hejinyu
*/
namespace RongCloud\Lib\Ultragroup\MuteAllMembers;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class MuteAllMembers
{
/**
* Super cluster module path
*
* @var string
*/
private $jsonPath = 'Lib/Ultragroup/MuteAllMembers/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Validation configuration file
*
* @var string
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');
}
/**
* Set super group ban
*
* @param array $Group Add super group ban parameters
* @param
* $Group = [
* 'id'=> 'ujadk90ha', // Super group id
* 'busChannel'=> 'busid', // Channel id can be empty
* 'status'=> true, // Ultra group ban status true for ban 0 for cancel
* ];
* @return array
*/
public function set(array $Group=[]){
$conf = $this->conf['add'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Query the mute status of a super group
*
* @param array $Group ultra group parameter
* @param
* $Group = [
* 'id'=> 'ujadk90ha',//super group id
* 'busChannel'=> 'busid',//channel id can be empty
* ];
* @return array
*/
public function get(array $Group=[]){
$conf = $this->conf['get'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
}
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Ultragroup/MuteWhiteList/MuteWhiteList.php | RongCloud/Lib/Ultragroup/MuteWhiteList/MuteWhiteList.php | <?php
/**
* Super group ban whitelist
* @author hejinyu
*/
namespace RongCloud\Lib\Ultragroup\MuteWhiteList;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class MuteWhiteList
{
/**
* Super cluster module path
*
* @var string
*/
private $jsonPath = 'Lib/Ultragroup/MuteWhiteList/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Validation configuration file
*
* @var string
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');
}
/**
* Add super group mute whitelist
*
* @param array $Group Add super group mute whitelist parameter
* @param
* $Group = [
* 'id'=> 'ujadk90ha',//super group id
* 'busChannel'=> 'busid',//channel id can be empty
* 'members'=>[ //mute member list
* ['id'=> 'ujadk90ha']
* ]
* ];
* @return array
*/
public function add(array $Group=[]){
$conf = $this->conf['add'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'], 'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Group['members'] as &$v){
$v = $v['id'];
}
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'members'=> 'userIds'
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Unblock whitelist
*
* @param array $Group Unblock whitelist parameter
* @param
* $Group = [
* 'id'=> 'ujadk90ha',//Super group id
* 'busChannel'=> 'busid',//Channel id, can be empty
* 'members'=>[ //List of unblocked members
* ['id'=> 'ujadk90ha']
* ]
* ];
* @return array
*/
public function remove(array $Group=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'], 'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Group['members'] as &$v){
$v = $v['id'];
}
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'members'=> 'userIds'
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Query the forbidden word whitelist member list
*
* @param array $Group Parameter
* @param
* $Group = [
* 'id'=> 'ujadk90ha',//Super group id
* 'busChannel'=> 'busid',//Channel id Can be empty
* ];
* @return array
*/
public function getList(array $Group=[]){
$conf = $this->conf['getList'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
if($result['code'] == 200){
$result = (new Utils())->rename($result,['users'=>'members']);
}
return $result;
}
}
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Ultragroup/Gag/Gag.php | RongCloud/Lib/Ultragroup/Gag/Gag.php | <?php
/**
* Super group ban
* @author hejinyu
*/
namespace RongCloud\Lib\Ultragroup\Gag;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Gag
{
/**
* Super cluster module path
*
* @var string
*/
private $jsonPath = 'Lib/Ultragroup/Gag/';
/**
* Request configuration file
*
* @var string
*
*/
private $conf = '';
/**
* Validation configuration file
*
* @var string
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');
}
/**
* Add super group ban
*
* @param array $Group Parameters for adding super group ban
* @param
* $Group = [
* 'id'=> 'ujadk90ha', // Super group ID
* 'busChannel'=> 'busid', // Channel ID (can be empty)
* 'members'=>[ // List of banned members
* ['id'=> 'ujadk90ha']
* ]
* ];
* @return array
*/
public function add(array $Group=[]){
$conf = $this->conf['add'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'], 'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Group['members'] as &$v){
$v = $v['id'];
}
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'members'=> 'userIds'
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Unblock
*
* @param array $Group Unblock parameter
* @param
* $Group = [
* 'id'=> 'ujadk90ha',//Super group id
* 'busChannel'=> 'busid',//Channel id can be empty
* 'members'=>[ //Unblock member list
* ['id'=> 'ujadk90ha']
* ]
* ];
* @return array
*/
public function remove(array $Group=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'], 'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Group['members'] as &$v){
$v = $v['id'];
}
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'members'=> 'userIds'
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Query the list of banned members
*
* @param array $Group Parameters for lifting the ban
* @param
* $Group = [
* 'id'=> 'ujadk90ha', // Super group id
* 'busChannel'=> 'busid', // Channel id, can be empty
* ];
* @return array
*/
public function getList(array $Group=[]){
$conf = $this->conf['getList'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
if($result['code'] == 200){
$result = (new Utils())->rename($result,['users'=>'members']);
foreach ($result['members']?:[] as $k=>&$v){
$v = (new Utils())->rename($v,['userId'=>'id']);
}
}
return $result;
}
}
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Ultragroup/Expansion/Expansion.php | RongCloud/Lib/Ultragroup/Expansion/Expansion.php | <?php
/**
* Super group message extension
*/
namespace RongCloud\Lib\Ultragroup\Expansion;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class Expansion
{
/**
* @var string Message Extension
*/
private $jsonPath = 'Lib/Ultragroup/Expansion/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Verification configuration file
*
* @var string
*/
private $verify = '';
/**
* Person constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath . 'api.json');
$this->verify = Utils::getJson($this->jsonPath . '../verify.json');;
}
/**
* Set message extension
*
* @param array $param Set message extension parameters
* @param
* $param = [
* 'msgUID' => 'BRGM-DEN2-01E4-BN66', //Message unique identifier ID, which can be obtained by the server through the full message routing function.
* 'userId' => 'WNYZbMqpH', //The ID of the user who needs to set the extension for message sending.
* 'groupId' => 'tjw3zbMrU', //Group ID
* 'busChannel' => '', //Bus channel
* 'extraKeyVal' => ['type'=>'3'] //Custom message extension content in JSON structure, set in Key-Value pairs, e.g., {"type":"3"}. A single message can set up to 300 extension items, with a maximum of 100 items per setting.
* ];
* @return array
*/
public function set(array $param = [])
{
$conf = $this->conf['set'];
$error = (new Utils())->check([
'api' => $conf,
'model' => 'expansion',
'data' => $param,
'verify' => $this->verify['expansion']
]);
if ($error) return $error;
if (is_array($param['extraKeyVal'])) {
$param['extraKeyVal'] = json_encode($param['extraKeyVal'], JSON_UNESCAPED_UNICODE);
}
$result = (new Request())->Request($conf['url'], $param);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Delete message extension
*
* @param array $param Parameters for deleting message extension
* @param
* $param = [
* 'msgUID' => 'BRGM-DEN2-01E4-BN66', //Message unique identifier ID, which can be obtained by the server through the full message routing function.
* 'userId' => 'WNYZbMqpH', //The user ID of the message sender that needs to set the extension.
* 'groupId' => 'tjw3zbMrU', //Super group ID
* 'conversationType' => '1', //Conversation type, 1 for one-on-one chat, 3 for group chat. Only single chat and group chat types are supported.
* 'extraKey' => ['type'] //The Key value of the extension information to be deleted, with a maximum of 100 extension information items that can be deleted at once.
* 'busChannel => "" //buschannel can be empty
* ];
* @return array
*/
public function delete(array $param = [])
{
$conf = $this->conf['remove'];
$error = (new Utils())->check([
'api' => $conf,
'model' => 'expansion',
'data' => $param,
'verify' => $this->verify['expansion']
]);
if ($error) return $error;
if (is_array($param['extraKey'])) {
$param['extraKey'] = json_encode($param['extraKey'], JSON_UNESCAPED_UNICODE);
}
$result = (new Request())->Request($conf['url'], $param);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Get extension information
*
* @param array $param Parameters for obtaining extension information
* @param
* $param = [
* 'msgUID' => 'ujadk90ha', // Message unique identifier ID, which can be obtained by the server through the full message routing function.
* 'pageNo' => 1 // Page number, defaults to returning 300 extension information.
* ];
* @return array
*/
public function getList(array $param = [])
{
$conf = $this->conf['getList'];
$error = (new Utils())->check([
'api' => $conf,
'model' => 'expansion',
'data' => $param,
'verify' => $this->verify['expansion']
]);
if ($error) return $error;
$result = (new Request())->Request($conf['url'], $param);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
}
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Ultragroup/Notdisturb/Notdisturb.php | RongCloud/Lib/Ultragroup/Notdisturb/Notdisturb.php | <?php
namespace RongCloud\Lib\Ultragroup\Notdisturb;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
/**
* Super anti-interference
*/
class Notdisturb {
/**
* Super cluster module path
*
* @var string
*/
private $jsonPath = 'Lib/Ultragroup/Notdisturb/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Verify configuration file
*
* @var string
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');
}
/**
* Set Super Group Do Not Disturb
*
* @param array $Group Add super group mute parameters
* @param
* $Group = [
* 'id'=> 'ujadk90ha', // Super group id
* 'busChannel'=> 'busid', // Channel id (can be empty)
* 'unpushLevel'=> -1, // Ultra group Do Not Disturb Level
* -1: Notify all messages
* 0: Not set (default state for users, notify all messages; if super group default state is set, follow super group default settings)
* 1: Notify only @ messages, including @ specific user and @ everyone
* 2: Notify only @ specific user messages, and only notify the user who is @ mentioned.
* Example: @Zhang San will receive the notification, @ everyone will not receive the notification.
*
* 4: Notify only @ group members, only receive @ everyone notifications
* 5: Do not receive notifications, even for @ messages.
* ];
* @return array
*/
public function set(array $Group=[]){
$conf = $this->conf['add'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Query the super group/channel do-not-disturb status
*
* @param array $Group ultra group parameter
* @param
* $Group = [
* 'id'=> 'ujadk90ha',//super group id
* 'busChannel'=> 'busid',//channel id, can be empty
* ];
* @return array
*/
public function get(array $Group=[]){
$conf = $this->conf['get'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
} | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/Lib/Ultragroup/BusChannel/BusChannel.php | RongCloud/Lib/Ultragroup/BusChannel/BusChannel.php | <?php
/**
* Super group channel
* @author hejinyu
*/
namespace RongCloud\Lib\Ultragroup\BusChannel;
use RongCloud\Lib\Request;
use RongCloud\Lib\Utils;
class BusChannel
{
/**
* Super cluster module path
*
* @var string
*/
private $jsonPath = 'Lib/Ultragroup/BusChannel/';
/**
* Request configuration file
*
* @var string
*/
private $conf = '';
/**
* Validation configuration file
*
* @var string
*/
private $verify = '';
/**
* Conversation constructor.
*/
function __construct()
{
$this->conf = Utils::getJson($this->jsonPath.'api.json');
$this->verify = Utils::getJson($this->jsonPath.'../verify.json');
}
/**
* Add super group channel
*
* @param array $Group Parameters for adding a super group channel
* @param
* $Group = [
* 'id'=> 'ujadk90ha', // Super group ID
* 'busChannel'=> 'busid' // Channel ID
* 'type'=>0 // 0 Public channel, 1 Private channel
* ];
* @return array
*/
public function add(array $Group=[]){
$conf = $this->conf['add'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'], 'busChannel'=>$verify['busChannel']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Delete super group channel
*
* @param array $Group Parameters for deleting the super group channel
* @param
* $Group = [
* 'id'=> 'ujadk90ha', // Super group id
* 'busChannel'=> 'busid', // Channel id, can be empty
* ];
* @return array
*/
public function remove(array $Group=[]){
$conf = $this->conf['remove'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'], 'busChannel'=>$verify['busChannel']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Query channel list
*
* @param
* @return array
*/
public function getList($groupId = "", $page = 1, $limit = 20){
$conf = $this->conf['getList'];
$Group = ["page"=> $page, "limit"=>$limit,"groupId"=>$groupId];
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Super group channel type switch
*
* @param array $Group Super group channel type switch parameter
* @param
* $Group = [
* 'id'=> 'ujadk90ha',//Super group id
* 'busChannel'=> 'busid'//Channel id
* 'type'=>0 // 0 Public channel, 1 Private channel
* ];
* @return array
*/
public function change(array $Group=[]){
$conf = $this->conf['change'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'], 'busChannel'=>$verify['busChannel']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Add super group private channel members
*
* @param array $Group Add super group private channel members parameter
* @param
* $Group = [
* 'id'=> 'ujadk90ha',//Super group id
* 'busChannel'=> 'busid',//Channel id can be empty
* 'members'=>[ //Add super group private channel members
* ['id'=> 'ujadk90ha']
* ]
* ];
* @return array
*/
public function addPrivateUsers(array $Group=[]){
$conf = $this->conf['privateUserAdd'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'], 'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Group['members'] as &$v){
$v = $v['id'];
}
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'members'=> 'userIds'
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Remove private channel members
*
* @param array $Group Parameters for removing private channel members
* @param
* $Group = [
* 'id'=> 'ujadk90ha',//Super group id
* 'busChannel'=> 'busid',//Channel id, can be empty
* 'members'=>[ //List of private channel members to remove
* ['id'=> 'ujadk90ha']
* ]
* ];
* @return array
*/
public function removePrivateUsers(array $Group=[]){
$conf = $this->conf['privateUserRemove'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id'], 'members'=>$verify['members']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
foreach ($Group['members'] as &$v){
$v = $v['id'];
}
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
'members'=> 'userIds'
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
/**
* Query private channel member list
*
* @param array $Group Parameter
* @param
* $Group = [
* 'id'=> 'ujadk90ha',//Super group id
* 'busChannel'=> 'busid',//Channel id Can be empty
* 'page'=> 1,
* 'pageSize'=>1000,
* ];
* @return array
*/
public function getPrivateUserList(array $Group=[]){
$conf = $this->conf['getPrivateUsers'];
$verify = $this->verify['group'];
$verify = ['id'=>$verify['id']];
$error = (new Utils())->check([
'api'=> $conf,
'model'=> 'group',
'data'=> $Group,
'verify'=> $verify
]);
if($error) return $error;
$Group = (new Utils())->rename($Group, [
'id'=> 'groupId',
]);
$result = (new Request())->Request($conf['url'],$Group);
$result = (new Utils())->responseError($result, $conf['response']['fail']);
return $result;
}
}
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Group/MuteWhiteList.php | RongCloud/example/Group/MuteWhiteList.php | <?php
/**
* Group ban whitelist whitelist instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add group blocklist
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// Group ID
'members'=>[// Forbidden personnel whitelist
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
,
];
$result = $RongSDK->getGroup()->MuteWhiteList()->add($group);
Utils::dump("Add group blocklist",$result);
}
add();
/**
* Query the forbidden whitelist member list
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// group id
];
$result = $RongSDK->getGroup()->MuteWhiteList()->getList($group);
Utils::dump("Query the forbidden whitelist member list",$result);
}
getList();
/**
* Remove the ban from the whitelist
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// Group ID
'members'=>[ //Unblock the whitelist personnel list
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
];
$result = $RongSDK->getGroup()->MuteWhiteList()->remove($group);
Utils::dump("Remove the ban from the whitelist",$result);
}
remove();
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Group/Group.php | RongCloud/example/Group/Group.php | <?php
/**
* Group module
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Group information synchronization
*/
function sync()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'uPj70HUrRSUk-ixtt7iIGc',// User ID
'groups'=>[['id'=> 'php group1', 'name'=> 'watergroup']]// User group information
];
$result = $RongSDK->getGroup()->sync($group);
Utils::dump("Group information synchronization",$result);
}
sync();
/**
* Create a group
*/
function create()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// Group ID
'name'=> 'watergroup',// Group name
'members'=>[ // Group member list
['id'=> 'uPj70HUrRSUk-ixtt7iIGc'],['id'=>'Vu-oC0_LQ6kgPqltm_zYtI']
]
];
$result = $RongSDK->getGroup()->create($group);
Utils::dump("Create a group",$result);
}
create();
/**
* Get group information
*/
function get()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// @param group id
];
$result = $RongSDK->getGroup()->get($group);
Utils::dump("Get group information",$result);
}
get();
/**
* Join the group
*/
function joins()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// Group ID
'name'=>"watergroup",// Group name
'member'=>['id'=> 'group999'],// Group member information
];
$result = $RongSDK->getGroup()->joins($group);
Utils::dump("Join the group",$result);
}
joins();
/**
* Exit group
*/
function quit()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// Group ID
'member'=>['id'=> 'uPj70HUrRSUk-ixtt7iIGc']// Exit personnel information
];
$result = $RongSDK->getGroup()->quit($group);
Utils::dump("Exit group",$result);
}
quit();
/**
* Disband the group
*/
function dismiss()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// Group ID
'member'=>['id'=> 'group999']// Administrator Information
];
$result = $RongSDK->getGroup()->dismiss($group);
Utils::dump("Disband the group",$result);
}
dismiss();
/**
* Modify group information
*/
function update()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// Group ID
'name'=>"watergroup"// group name
];
$result = $RongSDK->getGroup()->update($group);
Utils::dump("Modify group information",$result);
}
update();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Group/Gag.php | RongCloud/example/Group/Gag.php | <?php
/**
* Group ban example
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add group ban words
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// Group ID
'members'=>[ // Forbidden personnel list
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
,
'minute'=>3000 // Forbidden duration
];
$result = $RongSDK->getGroup()->Gag()->add($group);
Utils::dump("Add group ban words",$result);
}
add();
/**
* Query the list of banned members
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// group id
];
$result = $RongSDK->getGroup()->Gag()->getList($group);
Utils::dump("Query the list of banned members",$result);
}
getList();
/**
* Unblock
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// Group ID
'members'=>[ //Unblock the list of banned personnel
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
];
$result = $RongSDK->getGroup()->Gag()->remove($group);
Utils::dump("Unblock",$result);
}
remove();
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Group/Remark.php | RongCloud/example/Group/Remark.php | <?php
/**
* Group module group annotation
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define("APPSECRET", '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add group annotation
*/
function set()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'userId'=> 'ujadk90ha1',// @param personnelId
'groupId'=>'abca',// Group ID
'remark'=> '人员备注'// Group annotation
];
$Remark = $RongSDK->getGroup()->Remark()->set($group);
Utils::dump("Add group annotation",$Remark);
}
set();
/**
* Delete group backup
*/
function del()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'userId'=> 'ujadk90ha11',// Personnel ID
'groupId'=>'abca',// Group ID
];
$Remark = $RongSDK->getGroup()->Remark()->del($group);
Utils::dump("Delete group backup",$Remark);
}
del();
/**
* Get group remarks
*/
function get()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'userId'=> 'ujadk90ha1',// Personnel ID
/* Personnel ID */
'groupId'=>'abca',// Group ID
];
$Remark = $RongSDK->getGroup()->Remark()->get($group);
Utils::dump("Get group remarks",$Remark);
}
get(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Group/MuteAllMembers.php | RongCloud/example/Group/MuteAllMembers.php | <?php
/**
* Specify the group-wide ban instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add group ban
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// group id
];
$result = $RongSDK->getGroup()->MuteAllMembers()->add($group);
Utils::dump("Add group ban",$result);
}
add();
/**
* Query the list of banned members
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
];
$result = $RongSDK->getGroup()->MuteAllMembers()->getList($group);
Utils::dump("Query the list of banned members",$result);
}
getList();
/**
* Remove ban
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'php group1',// group id
];
$result = $RongSDK->getGroup()->MuteAllMembers()->remove($group);
Utils::dump("Remove ban",$result);
}
remove();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Push/Push.php | RongCloud/example/Push/Push.php | <?php
/**
* Push instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define("APPSECRET", '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Broadcast Message
*/
function broadcast()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$sensitive = [
'platform'=> ['ios','android'],// Target operating system
'fromuserid'=>'mka091amn',// Recipient User ID
'audience'=>['is_to_all'=>true],// Push conditions, including: tag, userid, is_to_all.
'message'=>['content'=>json_encode(['content'=>'1111','extra'=>'aaa']),'objectName'=>'RC:TxtMsg'],// Send message content
'notification'=>['alert'=>"this is a push",'ios'=>['alert'=>'abc'],'android'=>['alert'=>'abcd']]
];
$result = $RongSDK->getPush()->broadcast($sensitive);
Utils::dump("Broadcast Message",$result);
}
broadcast();
/**
* Push notifications
*/
function push()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$sensitive = [
'platform'=> ['ios','android'],// Target operating system
'audience'=>['is_to_all'=>true],// Push conditions, including: tag, userid, is_to_all.
'notification'=>['alert'=>"this is a push"]
];
$result = $RongSDK->getPush()->push($sensitive);
Utils::dump("Push notifications",$result);
}
push();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/MuteGroups.php | RongCloud/example/User/MuteGroups.php | <?php
/**
* Global group ban instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add group ban
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'members'=>[// Forbidden personnel list
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
],
'minute'=>3000 // Forbidden utterance duration
];
$result = $RongSDK->getUser()->MuteGroups()->add($group);
Utils::dump("add",$result);
}
add();
/**
* Query the list of banned members
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
];
$result = $RongSDK->getUser()->MuteGroups()->getList($group);
Utils::dump("getList",$result);
}
getList();
/**
* Unblock
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'members'=>[ //Unblock banned user list
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
];
$result = $RongSDK->getUser()->MuteGroups()->remove($group);
Utils::dump("remove",$result);
}
remove();
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/Tag.php | RongCloud/example/User/Tag.php | <?php
/**
* User Module User Tag
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define("APPSECRET", '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add user tag
*/
function set()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'userId'=> 'ujadk90ha1',// User ID
'tags'=> ['tag557','tag4']// User tag
];
$Block = $RongSDK->getUser()->Tag()->set($user);
Utils::dump("set",$Block);
}
set();
/**
* Batch add user tags
*/
function batchset()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'userIds'=> ['ujadk90ha1','ujadk90ha2'],// User ID
'tags'=> ['tag567','tag2']// User tag
];
$Block = $RongSDK->getUser()->Tag()->batchset($user);
Utils::dump("batchset",$Block);
}
batchset();
/**
* Get user tags
*/
function get()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'userIds'=> ['ujadk90ha1','ujadk90ha2'],// User ID
];
$Block = $RongSDK->getUser()->Tag()->get($user);
Utils::dump("get",$Block);
}
get(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/Profile.php | RongCloud/example/User/Profile.php | <?php
/**
* User Module User Label
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define("APPSECRET", '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* User profile settings
*/
function set()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$params = [
'userId' => 'ujadk90ha1',// User ID
'userProfile' => [
'name' => 'testName',
'email' => 'tester@rongcloud.cn'
], // User basic information
'userExtProfile' => [
'ext_Profile1' => 'testpro1'
] // User extension information
];
$res = $RongSDK->getUser()->Profile()->set($params);
Utils::dump("set", $res);
}
set();
/**
* Clear user custody information
*/
function clean()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$params = [
'userId' => ['ujadk90ha1', 'ujadk90ha2'],// User ID
];
$res = $RongSDK->getUser()->Profile()->clean($params);
Utils::dump("clean", $res);
}
clean();
/**
* Batch query user data
*/
function batchQuery()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$params = [
'userId' => ['ujadk90ha1', 'ujadk90ha2'],// User ID
];
$res = $RongSDK->getUser()->Profile()->batchQuery($params);
Utils::dump("batchQuery", $res);
}
batchQuery();
/**
* Paginate to retrieve the full list of application users
*/
function query()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$params = [
'page' => 1,
'size' => 20,
'order' => 0
];
$res = $RongSDK->getUser()->Profile()->query($params);
Utils::dump("query", $res);
}
query();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/User.php | RongCloud/example/User/User.php | <?php
/**
* User module user instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET', '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* User registration
*/
function register()
{
// Connect to the Singapore data center
// RongCloud::$apiUrl = ['http://api.sg-light-api.com/'];
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$user = [
'id' => 'CHIQ1',
'name' => 'PHPSDK', // Username
'portrait' => '' // User avatar
];
$register = $RongSDK->getUser()->register($user);
Utils::dump("register", $register);
}
register();
/**
* User information update
*/
function update()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$user = [
'id' => 'ujadk90ha', // User ID
'name' => 'Maritn', // Username
'portrait' => ' http://7xogjk.com1.z0.glb.clouddn.com/IuDkFprSQ1493563384017406982' //User avatar
];
$update = $RongSDK->getUser()->update($user);
Utils::dump("update", $update);
}
update();
/**
* Retrieve user information
*/
function get()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$user = [
'id' => 'ujadk90ha', // User ID
];
$res = $RongSDK->getUser()->get($user);
Utils::dump("get", $res);
}
get();
/**
* User logout
*/
function abandon()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$user = [
'id' => 'ujadk90ha', // User ID
];
$res = $RongSDK->getUser()->abandon($user);
Utils::dump("abandon", $res);
}
abandon();
/**
* Reactivate user ID
*/
function reactivate()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$user = [
'id' => ['55vW81Mni', 'kkj9o02'],
'time' => 1623123911000
];
$res = $RongSDK->getUser()->reactivate($user);
Utils::dump("reactivate", $res);
}
reactivate();
/**
* List of unsubscribed users
*/
function abandonQuery()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$params = [
'page' => 1, // Page number
'size' => 10, // Page count
];
$res = $RongSDK->getUser()->abandonQuery($params);
Utils::dump("abandonQuery", $res);
}
abandonQuery();
/**
* Deactivate Activation
*/
function active()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$user = [
'id' => 'ujadk90ha', // User ID
];
$res = $RongSDK->getUser()->activate($user);
Utils::dump("active", $res);
}
active();
/**
* Query the user's group
*/
function getGroups()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$user = [
'id' => '55vW81Mni', // User ID
];
$res = $RongSDK->getUser()->getGroups($user);
Utils::dump("getGroups", $res);
}
getGroups();
/**
* Token invalid
*/
function expire()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$user = [
'id' => ['55vW81Mni', 'kkj9o02'],
'time' => 1623123911000
];
$res = $RongSDK->getUser()->expire($user);
Utils::dump("expire", $res);
}
expire();
/**
* List of users(Dev)
*/
function userQuery()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$params = [
'page' => 1, // Page number
'size' => 10, // Page count
];
$res = $RongSDK->getUser()->query($params);
Utils::dump("userQuery", $res);
}
userQuery();
/**
* Delete users(Dev)
*/
function userDel()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$params = [
'id' => ['55vW81Mni', 'kkj9o02']
];
$res = $RongSDK->getUser()->del($params);
Utils::dump("userDel", $res);
}
userDel();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/Whitelist.php | RongCloud/example/User/Whitelist.php | <?php
/**
* User module whitelist instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add to whitelist
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha',// User ID
'whitelist'=> ['kkj9o01']// The list of personnel requiring whitelist addition
];
$Whitelist = $RongSDK->getUser()->Whitelist()->add($user);
Utils::dump("add",$Whitelist);
}
add();
/**
* Remove whitelist
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha',// User ID
'whitelist'=> ['kkj9o02']// List of personnel to be removed from the whitelist
];
$Whitelist = $RongSDK->getUser()->Whitelist()->remove($user);
Utils::dump("remove",$Whitelist);
}
remove();
/**
* User whitelist
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha',// User ID
'size'=> 1000,// The number of rows per page when fetching the whitelist users, defaults to 1000 if not passed, with a maximum of no more than 1000
'pageToken'=> ''// Pagination information, the next request returns 'next', no pagination processing is done when not transmitting, defaults to fetching the first 1000 user lists, sorted in reverse order by whitelist addition time.
];
$Whitelist = $RongSDK->getUser()->Whitelist()->getList($user);
Utils::dump("getList",$Whitelist);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/BlockPushPeriod.php | RongCloud/example/User/BlockPushPeriod.php | <?php
/**
* User module no disturbance period
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add a Do Not Disturb period
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha',// User ID
'startTime' => "23:59:59",// Do not disturb start time
'period'=>'600',// Do not disturb duration in minutes
'level'=>1,// Do Not Disturb Level 1 only targets single chats and @ messages for notifications, including @ specific users and @ all messages.
// No notifications are received, even for @ messages.
];
$Blacklist = $RongSDK->getUser()->BlockPushPeriod()->add($user);
Utils::dump("add",$Blacklist);
}
add();
/**
* Remove the do-not-disturb period
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha',// User ID
];
$Blacklist = $RongSDK->getUser()->BlockPushPeriod()->remove($user);
Utils::dump("remove",$Blacklist);
}
/**
* Get the do-not-disturb period
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha',// User ID
];
$Blacklist = $RongSDK->getUser()->BlockPushPeriod()->getList($user);
Utils::dump("getList",$Blacklist);
}
getList();
remove(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/Blacklist.php | RongCloud/example/User/Blacklist.php | <?php
/**
* User module blacklist instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add to blacklist
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha',// User ID
'blacklist'=> ['kkj9o01']// List of personnel to be added to the blacklist
];
$Blacklist = $RongSDK->getUser()->Blacklist()->add($user);
Utils::dump("add",$Blacklist);
}
add();
/**
* Remove blacklist
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha',// User ID
'blacklist'=> ['kkj9o02']// List of personnel requiring removal from the blacklist
];
$Blacklist = $RongSDK->getUser()->Blacklist()->remove($user);
Utils::dump("remove",$Blacklist);
}
remove();
/**
* User blacklist
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha',// User ID
'size'=> 1000,// @param pageSize The number of rows per page when fetching the blacklist user list, default is 1000 if not provided, maximum does not exceed 1000
'pageToken'=> ''// Pagination information, the previous request returns next, no pagination processing when not transmitting, defaults to fetching the first 1000 user lists, sorted in reverse order by blacklist addition time.
];
$Blacklist = $RongSDK->getUser()->Blacklist()->getList($user);
Utils::dump("getList",$Blacklist);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/Ban.php | RongCloud/example/User/Ban.php | <?php
/**
* User module whitelist instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET', '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Set user single chat ban
*/
function set()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$user = [
'id' => ['kkj9o01', 'kkj9o02'], // Banned user Ids, supports batch setting, with a maximum of no more than 1000.
'state' => 1, // Forbidden status, 0 Remove forbidden. 1 Add forbidden
'type' => 'PERSON', // conversation type, currently supports single conversation PERSON
];
$res = $RongSDK->getUser()->Ban()->set($user);
Utils::dump("set", $res);
}
set();
/**
* Query the list of users with single chat ban remarks
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'num' => 101, // Get the number of rows, default is 100, maximum support is 200.
'offset' => 0, // The starting position for the query, default is 0.
'type' => 'PERSON'// Conversation type, currently supports single conversation PERSON.
];
$res = $RongSDK->getUser()->Ban()->getList($param);
Utils::dump("getList", $res);
}
getList();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/Onlinestatus.php | RongCloud/example/User/Onlinestatus.php | <?php
/**
* User Module User Online Status
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Online status
*/
function check()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90hadsdfasdf',
];
$register = $RongSDK->getUser()->Onlinestatus()->check($user);
Utils::dump("check",$register);
}
check();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/Block.php | RongCloud/example/User/Block.php | <?php
/**
* User module User ban instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* banned user
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha1',// User ID unique identifier, maximum length 30 characters
'minute'=> 20// Blocking duration 1 - 1 * 30 * 24 * 60 minutes
];
$Block = $RongSDK->getUser()->Block()->add($user);
Utils::dump("banned user",$Block);
}
add();
/**
* Unblock user
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'id'=> 'ujadk90ha1',// Unlock user ID unique identifier, maximum length 30 characters
];
$Block = $RongSDK->getUser()->Block()->remove($user);
Utils::dump("remove",$Block);
}
remove();
/**
* Banned user list
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
];
$Block = $RongSDK->getUser()->Block()->getList($user);
Utils::dump("getList",$Block);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/MuteChatrooms.php | RongCloud/example/User/MuteChatrooms.php | <?php
/**
* Chatroom member banned words
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add chat room member mute
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'members'=> [
['id'=>'seal9901']// Forbidden personnel id
],
'minute'=>30// Forbidden speech duration
];
$MuteChatrooms = $RongSDK->getUser()->MuteChatrooms()->add($chatroom);
Utils::dump("add",$MuteChatrooms);
}
add();
/**
* Unmute chat room member
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'members'=> [
['id'=>'seal9901']// Personnel ID
],
];
$MuteChatrooms = $RongSDK->getUser()->MuteChatrooms()->remove($chatroom);
Utils::dump("remove",$MuteChatrooms);
}
remove();
/**
* Get the list of muted members in the chat room
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
];
$MuteChatrooms = $RongSDK->getUser()->MuteChatrooms()->getList($chatroom);
Utils::dump("getList",$MuteChatrooms);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/User/Remark.php | RongCloud/example/User/Remark.php | <?php
/**
* User module user remarks
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define("APPSECRET", '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add user remarks
*/
function set()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'userId'=> 'ujadk90ha1',// User ID
'remarks'=> json_encode([['id'=>'user1','remark'=>'note4'],['id'=>'user2','remark'=>'note4']])// User Annotation
];
$Remark = $RongSDK->getUser()->Remark()->set($user);
Utils::dump("set",$Remark);
}
set();
/**
* Delete user remarks
*/
function del()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'userId'=> 'ujadk90ha1',// User ID
'targetId'=> "userId1"// User backup
];
$Remark = $RongSDK->getUser()->Remark()->del($user);
Utils::dump("del",$Remark);
}
del();
/**
* Get user remark
*/
function get()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$user = [
'userId'=> 'ujadk90ha1',// User ID
'size'=>100,
'page'=>1
];
$Remark = $RongSDK->getUser()->Remark()->get($user);
Utils::dump("get",$Remark);
}
get(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Sensitive/Sensitive.php | RongCloud/example/Sensitive/Sensitive.php | <?php
/**
* Sensitive word example
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET', '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add sensitive words
*/
function add()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$sensitive = [
'replace' => '***',// Sensitive word replacement, maximum length not exceeding 32 characters, sensitive word filtering can be empty
'keyword' => "abc",// Sensitive word
'type' => 0// 0: Sensitive word substitution 1: Sensitive word filtering
];
$result = $RongSDK->getSensitive()->add($sensitive);
Utils::dump("Add sensitive words", $result);
}
add();
function batchAdd()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$sensitive = [
'words' => [
[
'word' => "abc1",// Screen
],
[
'word' => "abc2",// Sensitive words
'replaceWord' => '***'// Sensitive word replacement, maximum length not exceeding 32 characters, sensitive word screening can be empty
]
]
];
$result = $RongSDK->getSensitive()->batchAdd($sensitive);
Utils::dump("batchAdd", $result);
}
batchAdd();
/**
* Remove sensitive words
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$sensitive = [
'keywords' => ["cccccdddd"]// Delete sensitive words
];
$result = $RongSDK->getSensitive()->remove($sensitive);
Utils::dump("Remove sensitive words", $result);
}
remove();
/**
* Get the list of sensitive words
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$sensitive = [
'type' => '',// Sensitive word type, 0: Sensitive word replacement, 1: Sensitive word shielding, empty to retrieve all
];
$result = $RongSDK->getSensitive()->getList($sensitive);
Utils::dump("Get the list of sensitive words", $result);
}
getList();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Message/History.php | RongCloud/example/Message/History.php | <?php
/**
* Message module history message instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Historical message retrieval
*/
function get()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'date'=> '2019011711',//Date
];
$Chartromm = $RongSDK->getMessage()->History()->get($message);
Utils::dump("Historical message retrieval",$Chartromm);
}
get();
/**
* Historical message file deletion
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'date'=> '2018011116',//Date
];
$Chartromm = $RongSDK->getMessage()->History()->remove($message);
Utils::dump("Historical message file deletion",$Chartromm);
}
remove();
/**
* Message clearance
*/
function clean()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'conversationType'=> '1',//Conversation types, supporting single chat, group chat, and system notifications. Single chat is 1, group chat is 3, and system notification is 6.
'fromUserId'=>"fromUserId",//@param userID The user ID
//@param msgTimestamp The timestamp of the session message to delete historical messages before
'targetId'=>"userId",//The target session ID that needs to be cleared
'msgTimestamp'=>"1588838388320",//Clear all historical messages before the specified timestamp, accurate to the millisecond, to empty all historical messages of the session.
];
$Chartromm = $RongSDK->getMessage()->History()->clean($message);
Utils::dump("Message clearance",$Chartromm);
}
clean();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Message/Expansion.php | RongCloud/example/Message/Expansion.php | <?php
/**
* Message module two-person message instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET', '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Two-person message sending
*/
function set()
{
// Connect to the Singapore Data Center
// RongCloud::$apiUrl = ['http://api.sg-light-api.com/'];
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'msgUID' => 'BS45-NPH4-HV87-10LM', // Message unique identifier, the server can obtain it through the full message routing function.
'userId' => 'WNYZbMqpH', // Need to set the extended message delivery user Id.
'targetId' => 'tjw3zbMrU', // Target ID, depending on the conversationType, could be a user ID or a group ID.
'conversationType' => '1', // Conversation type, one-on-one chat is 1, group chat is 3, only supports single chat and group chat types.
'extraKeyVal' => ['type1' => '1', 'type2' => '2', 'type3' => '3', 'type4' => '4',],// Custom message extension content, JSON structure, set in Key, Value format
'isSyncSender' => 0 // Whether the sender accepts the terminal user's online status, 0 indicates not accepting, 1 indicates accepting, default is 0 not accepting
];
$res = $RongSDK->getMessage()->Expansion()->set($message);
Utils::dump("Two-person message sending", $res);
}
set();
/**
* Send different content messages to multiple users
*/
function delete()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'msgUID' => 'BS45-NPH4-HV87-10LM', // The unique message identifier, which can be obtained by the server through the full message routing function.
'userId' => 'WNYZbMqpH', // Set the extended message sending user Id.
'targetId' => 'tjw3zbMrU', // Target ID, depending on the conversationType, could be a user ID or a group ID.
'conversationType' => '1', // Conversation type, one-on-one conversation is 1, group conversation is 3, only supports single chat and group conversation types.
'extraKey' => ['type1', 'type2'], // The key value of the extension information to be deleted, with a maximum of 100 extension information items that can be deleted at once
'isSyncSender' => 0 // Terminal user online status, whether the sender accepts this setting status, 0 indicates not accepted, 1 indicates accepted, default is 0 not accepted
];
$res = $RongSDK->getMessage()->Expansion()->delete($message);
Utils::dump("Send different content messages to multiple users", $res);
}
delete();
/**
* Two-person status message sending
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'msgUID' => 'BS45-NPH4-HV87-10LM', // The unique message identifier, which can be obtained by the server through the full message routing function.
'pageNo' => 1 // Page count, default returns 300 expanded information.
];
$res = $RongSDK->getMessage()->Expansion()->getList($message);
Utils::dump("Two-person status message sending", $res);
}
getList();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Message/Broadcast.php | RongCloud/example/Message/Broadcast.php | <?php
/**
* Message module broadcast message
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Broadcast message recall
*/
function recall()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'test',// Sender ID
"objectName"=>'RC:RcCmd',// Message type
'content'=>json_encode([
'uId'=>'xxxxx',// The unique message identifier, obtained after sending a broadcast message via /push, returns the name as id.
'isAdmin'=>'0',// Whether it is an administrator, default is 0; when set to 1, IMKit SDK will display the gray bar as "Admin revoked a message" upon receiving this message.
'isDelete'=>'0'// Whether to delete the message, default is 0: when the message is revoked, the client will delete the message and replace it with a small gray bar revocation prompt message; when it is 1, after the message is deleted, it will not be replaced with a small gray bar prompt message.
])
];
$Result = $RongSDK->getMessage()->Broadcast()->recall($message);
Utils::dump("Broadcast message recall",$Result);
}
recall();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Message/Chatroom.php | RongCloud/example/Message/Chatroom.php | <?php
/**
* Message module chat room message instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Send messages in the chat room
*/
function send()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'aP9uvganV',// Sender ID
'targetId'=> ['OIBbeKlkx'],// Chat room ID
"objectName"=>'RC:TxtMsg',// Message type: Text
'content'=>json_encode(['content'=>'php chatroom 你好,主播'])// Message content
];
$Chartromm = $RongSDK->getMessage()->Chatroom()->send($message);
Utils::dump("Send messages in the chat room",$Chartromm);
}
send();
/**
* Chat room broadcast message
*/
function broadcast()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'aP9uvganV',// Sender ID
"objectName"=>'RC:TxtMsg',// Message type Text
'content'=>json_encode(['content'=>'php Chatroom Broadcast 你好,主播'])// Message content
];
$Chartromm = $RongSDK->getMessage()->Chatroom()->broadcast($message);
Utils::dump("Chat room broadcast message",$Chartromm);
}
broadcast();
/**
* Withdraw a sent chat room message
*/
function recall()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'ujadk90ha',// Sender Id
'targetId'=> ['STRe0shISpQlSOBvek1FfU'],// Chat room id
"uId"=>'5GSB-RPM1-KP8H-9JHF',// The unique identifier of the message
'sentTime'=>'1519444243981'// Message delivery time
];
$Result = $RongSDK->getMessage()->Chatroom()->recall($message);
Utils::dump("Withdraw a sent chat room message",$Result);
}
recall();
function getHistoryMsg()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'userId' => 'tester1',
'targetId' => 'tester2',
'startTime' => time() * 1000,
"endTime" => strtotime('-10 day') * 1000,
'includeStart' => true
];
$res = $RongSDK->getMessage()->Chatroom()->getHistoryMsg($param);
Utils::dump("getHistoryMsg", $res);
}
getHistoryMsg(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Message/System.php | RongCloud/example/Message/System.php | <?php
/**
* Message module system message module
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET', '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* System message delivery
*/
function send()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'senderId' => '__system__',// Sender ID
'targetId' => 'uPj70HUrRSUk-ixtt7iIGc',// Receive release id
"objectName" => 'RC:TxtMsg',// Message type Text
'content' => ['content' => 'php system message']// Message Body
];
$Result = $RongSDK->getMessage()->System()->send($message);
Utils::dump("System message delivery", $Result);
}
send();
/**
* System broadcast message
*/
function broadcast()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'senderId' => '__system__',// Sender ID
"objectName" => 'RC:TxtMsg',// Message type
'content' => ['content' => 'php broadcast message']// Message content
];
$Result = $RongSDK->getMessage()->System()->broadcast($message);
Utils::dump("System broadcast message", $Result);
}
broadcast();
/**
* Broadcast to online users
*/
function onlineBroadcast()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'senderId' => '__system__',// Sender ID
"objectName" => 'RC:TxtMsg',// Message type
'content' => ['content' => 'php broadcast message']// Message content
];
$Result = $RongSDK->getMessage()->System()->onlineBroadcast($message);
Utils::dump("Broadcast to online users", $Result);
}
onlineBroadcast();
/**
* System template message
*/
function sendTemplate()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'senderId' => '__system__',// Sender ID
'objectName' => 'RC:TxtMsg',// Message type Text
'template' => json_encode(['content' => '{name}, Language score {score}']),// Template content
'content' => json_encode([
'Vu-oC0_LQ6kgPqltm_zYtI' => [// Recipient ID
'data' => ['{name}' => 'Xiaoming', '{score}' => '90'],// Template data
'push' => '{name} php System Template Message',// Push content
],
'uPj70HUrRSUk-ixtt7iIGc' => [// Recipient ID
'data' => ['{name}' => 'Xiaohong', '{score}' => '95'],// Template data
'push' => '{name} PHP system template message',// push notification content
]
])
];
$Chartromm = $RongSDK->getMessage()->System()->sendTemplate($message);
Utils::dump("System template message", $Chartromm);
}
sendTemplate();
/**
* Push-only Notification
*/
function pushUser()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'userIds' => ["user1","user2"],// Recipient ID
'notification' => [
"pushContent"=>"push content",
"title"=>"push title",
"ios"=>
[
"thread-id"=>"223",
"apns-collapse-id"=>"111",
"extras"=> ["id"=>"1","name"=>"2"]
],
"android"=> [
"hw"=>[
"channelId"=>"NotificationKanong",
"importance"=> "NORMAL",
"image"=>"https://example.com/image.png"
],
"mi"=>[
"channelId"=>"rongcloud_kanong",
"large_icon_uri"=>"https=>//example.com/image.png"
],
"oppo"=>[
"channelId"=>"rc_notification_id"
],
"vivo"=>[
"classification"=>"0"
],
"extras"=> ["id"=> "1","name"=> "2"]
]
]
];
$Chartromm = $RongSDK->getMessage()->System()->pushUser($message);
Utils::dump("Push-only Notification", $Chartromm);
}
pushUser();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Message/Group.php | RongCloud/example/Message/Group.php | <?php
/**
* Message module group message instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Group message sending
*/
function send()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',// Sender ID
'targetId'=> ['php group1'],// Group ID
"objectName"=>'RC:TxtMsg',// Message type Text
'content'=>json_encode(['content'=>'PHP group message, hello, Xiaoming.'])// Message Body
];
$Result = $RongSDK->getMessage()->Group()->send($message);
Utils::dump("Group message sending",$Result);
}
send();
/**
* Send @ message
*/
function sendMention()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'ujadk90ha',// Sender ID
'targetId'=> ['STRe0shISpQlSOBvek1FfU'],// Group ID
"objectName"=>'RC:TxtMsg',// Message type Text
'content'=>json_encode([// Message content
'content'=>'PHP group @message, hello, Xiaoming',
'mentionedInfo'=>[
'type'=>'1',// Function type, 1 indicates @ all users, 2 indicates @ specified user
'userIds'=>['uPj70HUrRSUk-ixtt7iIGc'],// The @ list must be filled when the type is 2, and can be empty when the type is 1.
'pushContent'=>'PHP push greeting message'// Custom @ Message Push Content
]
])
];
$Result = $RongSDK->getMessage()->Group()->sendMention($message);
Utils::dump("Send @ message",$Result);
}
sendMention();
/**
* Group status message sending
*/
function sendStatusMessage()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',// Sender ID
'targetId'=> ['php group1'],// Group ID
"objectName"=>'RC:TxtMsg',// Message type Text
'content'=>json_encode(['content'=>'PHP group status message, hello, Xiaoming.'])// Message Body
];
$Result = $RongSDK->getMessage()->Group()->sendStatusMessage($message);
Utils::dump("Group status message sending",$Result);
}
sendStatusMessage();
/**
* Recall a sent group chat message
*/
function recall()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'ujadk90ha',//Sender ID
'targetId'=> ['STRe0shISpQlSOBvek1FfU'],//Group ID
"uId"=>'5GSB-RPM1-KP8H-9JHF',//The unique identifier of the message
'sentTime'=>'1519444243981'//Message sending time
];
$Result = $RongSDK->getMessage()->Group()->recall($message);
Utils::dump("Recall a sent group chat message",$Result);
}
recall();
function getHistoryMsg()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'userId' => 'YfvHSATMy',
'targetId' => 'M2z38Hwn9',
'startTime' => time() * 1000,
"endTime" => strtotime('-10 day') * 1000,
'includeStart' => true
];
$res = $RongSDK->getMessage()->Group()->getHistoryMsg($param);
Utils::dump("getHistoryMsg", $res);
}
getHistoryMsg(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Message/Person.php | RongCloud/example/Message/Person.php | <?php
/**
* Message Module Two-Person Message Instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Two-person message sending
*/
function send()
{
//Connect to Singapore Data Center
//RongCloud::$apiUrl = ['http://api.sg-light-api.com/'];
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',//Sender ID
'targetId'=> ['uPj70HUrRSUk-ixtt7iIGc'],//recipient id
"objectName"=>'RC:TxtMsg',//Message type Text
'content'=>json_encode(['content'=>'Hello, this is a two-person message'])//Message content
];
$Chartromm = $RongSDK->getMessage()->Person()->send($message);
Utils::dump("Two-person message sending",$Chartromm);
}
send();
/**
* Send different content messages to multiple users
*/
function sendTemplate()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',//Sender ID
'objectName'=>'RC:TxtMsg',//Message type: Text
'template'=>json_encode(['content'=>'{name}, Language score {score}']),// Template content
'content'=>json_encode([
'uPj70HUrRSUk-ixtt7iIGc'=>[//Recipient ID
'data'=>['{name}'=>'Xiaoming','{score}'=>'90'],//Template Data
'push'=>'{name} 你的成绩出来了',//Push content
],
'Vu-oC0_LQ6kgPqltm_zYtI'=>[//Recipient ID
'data'=>['{name}'=>'XiaoHong','{score}'=>'95'],// Template Data
'push'=>'{name} Your grades are in.',//push notification content
]
])
];
$Chartromm = $RongSDK->getMessage()->Person()->sendTemplate($message);
Utils::dump("Send different content messages to multiple users",$Chartromm);
}
sendTemplate();
/**
* Two-person status message sending
*/
function sendStatusMessage()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',//Sender ID
'targetId'=> ['uPj70HUrRSUk-ixtt7iIGc'],//Recipient ID
"objectName"=>'RC:TxtMsg',//Message type Text
'content'=>json_encode(['content'=>'Hello, this is a two-person status message.'])//Message content
];
$Chartromm = $RongSDK->getMessage()->Person()->sendStatusMessage($message);
Utils::dump("Two-person status message sending",$Chartromm);
}
sendStatusMessage();
/**
* Two-person message recall
*/
function recall()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',//Sender ID
'targetId'=> ['uPj70HUrRSUk-ixtt7iIGc'],//Recipient ID
"uId"=>'5GSB-RPM1-KP8H-9JHF',//Message unique identifier
'sentTime'=>'1519444243981'//Send time
];
$Chartromm = $RongSDK->getMessage()->Person()->recall($message);
Utils::dump("Two-person message recall",$Chartromm);
}
recall();
function getHistoryMsg()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'userId' => 'JmFV3UytI',
'targetId' => 'AI32767626983b4d11b691bb86248dd8f3',
'startTime' => time() * 1000,
"endTime" => strtotime('-10 day') * 1000,
'includeStart' => true
];
$res = $RongSDK->getMessage()->Person()->getHistoryMsg($param);
Utils::dump("getHistoryMsg", $res);
}
getHistoryMsg();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Message/Ultragroup.php | RongCloud/example/Message/Ultragroup.php | <?php
/**
* Message module super group message instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Super group message delivery
*/
function send()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',// Sender ID
'targetId'=> ['phpgroup1'],// Super group ID
"objectName"=>'RC:TxtMsg',// Message type Text
'content'=>json_encode(['content'=>'php Group message, hello, Xiaoming'])// Message Body
];
$Result = $RongSDK->getMessage()->Ultragroup()->send($message);
Utils::dump("Super group message delivery",$Result);
}
send();
/**
* Send @ message
*/
function sendMention()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'ujadk90ha',// Sender ID
'targetId'=> ['STRe0shISpQlSOBvek1FfU'],// Supergroup ID
"objectName"=>'RC:TxtMsg',// Message type: Text
'content'=>json_encode([// Message content
'content'=>'PHP Group @message, hello, Xiaoming',
'mentionedInfo'=>[
'type'=>'1',// @function type, 1 represents @all, 2 represents @specified user
'userIds'=>['uPj70HUrRSUk-ixtt7iIGc'],// The @ list is mandatory when type is 2, and can be empty when type is 1
'pushContent'=>'php push greeting message'// Custom @ Message Push Content
]
])
];
$Result = $RongSDK->getMessage()->Ultragroup()->sendMention($message);
Utils::dump("Send @ message",$Result);
}
sendMention();
/**
* Supergroup message recall
*/
function recall()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$message = [
'senderId'=> 'Vu-oC0_LQ6kgPqltm_zYtI',// Sender ID
'targetId'=> ['uPj70HUrRSUk-ixtt7iIGc'],// Group ID
"uId"=>'5GSB-RPM1-KP8H-9JHF',// Message unique identifier
'sentTime'=>'1519444243981'// Delivery Time
/* Delivery Time */
];
$Chartromm = $RongSDK->getMessage()->Ultragroup()->recall($message);
Utils::dump("Supergroup message recall",$Chartromm);
}
recall();
function getHistoryMsg()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'userId' => 'tester1',
'targetId' => 'tester2',
'startTime' => time() * 1000,
"endTime" => strtotime('-10 day') * 1000,
'includeStart' => true
];
$res = $RongSDK->getMessage()->Ultragroup()->getHistoryMsg($param);
Utils::dump("getHistoryMsg", $res);
}
getHistoryMsg(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Entrust/GroupManager.php | RongCloud/example/Entrust/GroupManager.php | <?php
/**
* Group Information Management - Management Module Testing
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET', '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Set group administrator (Add group administrator)
*/
function add()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userIds' => ['C_U_1', 'C_U_2', 'C_U_3']
];
$result = $RongSDK->getEntrust()->GroupManager()->add($param);
Utils::dump("Set group administrator (Add group administrator)", $result);
}
add();
/**
* Remove group administrator
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userIds' => ['C_U_1', 'C_U_2', 'C_U_3']
];
$result = $RongSDK->getEntrust()->GroupManager()->remove($param);
Utils::dump("Remove group administrator", $result);
}
remove(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Entrust/GroupRemarkName.php | RongCloud/example/Entrust/GroupRemarkName.php | <?php
/**
* Group Information Hosting - Annotation Module Testing
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET', '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Set the user-specified group name remark
*/
function remarkNameSet()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userId' => '222',
'remarkName' => 'rongcloud'
];
$result = $RongSDK->getEntrust()->GroupRemarkName()->set($param);
Utils::dump("Set the user-specified group name remark", $result);
}
remarkNameSet();
/**
* Set user-specified group name annotation
*/
function remarkNameDelete()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userId' => '222'
];
$result = $RongSDK->getEntrust()->GroupRemarkName()->delete($param);
Utils::dump("Set user-specified group name annotation", $result);
}
remarkNameDelete();
/**
* Query the specified group name for user remarks
*/
function remarkNameQuery()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userId' => '222'
];
$result = $RongSDK->getEntrust()->GroupRemarkName()->query($param);
Utils::dump("Query the specified group name for user remarks", $result);
}
remarkNameQuery();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Entrust/GroupMember.php | RongCloud/example/Entrust/GroupMember.php | <?php
/**
* Group Information Hosting - Member Module Testing
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET', '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Set group member information
*/
function set()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userId' => '222',
'nickname' => 'rongcloud',
'extra' => 'xxxxxx'
];
$result = $RongSDK->getEntrust()->GroupMember()->set($param);
Utils::dump("Set group member information", $result);
}
set();
/**
* Kick out of the group
*/
function kick()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userIds' => ['123', '456'],
'isDelBan' => 1,
'isDelWhite' => 1,
'isDelFollowed' => 1
];
$result = $RongSDK->getEntrust()->GroupMember()->kick($param);
Utils::dump("Kick out of the group", $result);
}
kick();
/**
* Specify the user to kick out all groups
*/
function kickAll()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'userId' => '111'
];
$result = $RongSDK->getEntrust()->GroupMember()->kickAll($param);
Utils::dump("Specify the user to kick out all groups", $result);
}
kickAll();
/**
* Set user-specified group special attention users
*/
function follow()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userId' => '222',
'followUserIds' => ['111', '222']
];
$result = $RongSDK->getEntrust()->GroupMember()->follow($param);
Utils::dump("Set user-specified group special attention users", $result);
}
follow();
/**
* Remove the specified user from the group's special attention list
*/
function unFollow()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userId' => '222',
'followUserIds' => ['111', '222']
];
$result = $RongSDK->getEntrust()->GroupMember()->unFollow($param);
Utils::dump("Remove the specified user from the group's special attention list", $result);
}
unFollow();
/**
* Query the list of members in the specified group that the user particularly focuses on
*/
function getFollowed()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userId' => '222',
];
$result = $RongSDK->getEntrust()->GroupMember()->getFollowed($param);
Utils::dump("Query the list of members in the specified group that the user particularly focuses on", $result);
}
getFollowed();
/**
* Get group member information by pagination
*/
function query()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'type' => 0,
'pageToken' => '',
'size' => 50,
'order' => 1
];
$result = $RongSDK->getEntrust()->GroupMember()->query($param);
Utils::dump("Get group member information by pagination", $result);
}
query();
/**
* Get specified member information
*/
function specificQuery()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'userIds' => ['111', '222']
];
$result = $RongSDK->getEntrust()->GroupMember()->specificQuery($param);
Utils::dump("Get specified member information", $result);
}
specificQuery();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Entrust/Group.php | RongCloud/example/Entrust/Group.php | <?php
/**
* Group information module test
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET', '');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Create a group
*/
function create()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'name' => 'RC_NAME_1',
'owner' => 'RC_OWNER_1',
'userIds' => ['C_U_1', 'C_U_2', 'C_U_3']
];
$result = $RongSDK->getEntrust()->Group()->create($param);
Utils::dump("Create a group", $result);
}
create();
/**
* Set group resources
*/
function update()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'CHIQ_GROUP_2',
'name' => 'RC_NAME_2',
'groupProfile' => ['introduction' => 'i', 'announcement' => 'a', 'portraitUrl' => ''],
'permissions' => ['joinPerm' => 0, 'removePerm' => 0, 'memInvitePerm' => 0, 'invitePerm' => 0, 'profilePerm' => 0, 'memProfilePerm' => 0],
'groupExtProfile' => ['key' => 'value']
];
$result = $RongSDK->getEntrust()->Group()->update($param);
Utils::dump("Set group resources", $result);
}
update();
/**
* Exit group
*/
function quit()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'CHIQ_GROUP_2',
'userIds' => ['123', '456'],
'isDelBan' => 1,
'isDelWhite' => 1,
'isDelFollowed' => 1
];
$result = $RongSDK->getEntrust()->Group()->quit($param);
Utils::dump("Exit group", $result);
}
quit();
/**
* Disband group
*/
function dismiss()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'CHIQ_GROUP_2'
];
$result = $RongSDK->getEntrust()->Group()->dismiss($param);
Utils::dump("Disband group", $result);
}
dismiss();
/**
* Join the group
*/
function groupJoin()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'CHIQ_GROUP_2',
'userIds' => ['123', '456']
];
$result = $RongSDK->getEntrust()->Group()->join($param);
Utils::dump("Join the group", $result);
}
groupJoin();
/**
* Transfer group
*/
function transferOwner()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'CHIQ_GROUP_2',
'newOwner' => '123',
'isQuit' => 0,
'isDelBan' => 1,
'isDelWhite' => 1,
'isDelFollowed' => 1
];
$result = $RongSDK->getEntrust()->Group()->transferOwner($param);
Utils::dump("Transfer group", $result);
}
transferOwner();
/**
* Group hosting import
*/
function import()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupId' => 'RC_GROUP_1',
'name' => 'RC_NAME_1',
'owner' => 'RC_OWNER_1',
'groupProfile' => ['introduction' => 'i', 'announcement' => 'a', 'portraitUrl' => ''],
'permissions' => ['joinPerm' => 0, 'removePerm' => 0, 'memInvitePerm' => 0, 'invitePerm' => 0, 'profilePerm' => 0, 'memProfilePerm' => 0],
'groupExtProfile' => ['key' => 'value']
];
$result = $RongSDK->getEntrust()->Group()->import($param);
Utils::dump("Group hosting import", $result);
}
import();
/**
* Query application group information under pagination
*/
function query()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'pageToken' => '',
'size' => 50,
'order' => 1
];
$result = $RongSDK->getEntrust()->Group()->query($param);
Utils::dump("Query application group information under pagination", $result);
}
query();
/**
* Pagination query for users added to the group
*/
function joinedQuery()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'userId' => '10',
'role' => 0,
'pageToken' => 'xxxx',
'size' => 50,
'order' => 1
];
$result = $RongSDK->getEntrust()->Group()->joinedQuery($param);
Utils::dump("Pagination query for users added to the group", $result);
}
joinedQuery();
/**
* Batch query group data
*/
function profileQuery()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$param = [
'groupIds' => ['RC_GROUP_1', 'CHIQ_GROUP_2']
];
$result = $RongSDK->getEntrust()->Group()->profileQuery($param);
Utils::dump("Batch query group data", $result);
}
profileQuery();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Conversation/Conversation.php | RongCloud/example/Conversation/Conversation.php | <?php
/**
* Conversation example
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Set user's session screen to Push
*/
function mute()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$conversation = [
'type'=> 'PRIVATE',// Conversation types: PRIVATE, GROUP, DISCUSSION, SYSTEM
'userId'=>'Vu-oC0_LQ6kgPqltm_zYtI',// Session owner
'targetId'=>'Vu-oC0_LQ6kgPqltm_zYtI'// Session ID
];
$result = $RongSDK->getConversation()->mute($conversation);
Utils::dump("Set user's session screen to Push",$result);
}
mute();
/**
* Set the user to receive Push notifications for a specific session
*/
function unmute()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$conversation = [
'type'=> 'PRIVATE',// Session types PRIVATE, GROUP, DISCUSSION, SYSTEM
'userId'=>'mka091amn',// Session owner
'targetId'=>'adm1klnm'// Session ID
];
$result = $RongSDK->getConversation()->unmute($conversation);
Utils::dump("Set the user to receive Push notifications for a specific session",$result);
}
unmute();
/**
* Set whether a conversation is pinned.
*/
function pinned()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$conversation = [
'userId'=>'mka091amn',
'conversationType'=>'1',
'targetId'=>'adm1klnd',
'setTop'=>'true'
];
$result = $RongSDK->getConversation()->pinned($conversation);
Utils::dump("Set whether a conversation is pinned",$result);
}
pinned();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/Distribute.php | RongCloud/example/Chatroom/Distribute.php | <?php
/**
* Chat room message distribution
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Stop chat room message distribution
*/
function stop()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> "Txtmsg03"// Chatroom ID
/* Chatroom ID */
];
$Demotion = $RongSDK->getChatroom()->Distribute()->stop($chatroom);
Utils::dump("Stop chat room message distribution",$Demotion);
}
stop();
/**
* Restore chat room message distribution
*/
function resume()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> "Txtmsg03"// Chatroom ID
];
$Demotion = $RongSDK->getChatroom()->Distribute()->resume($chatroom);
Utils::dump("Restore chat room message distribution",$Demotion);
}
resume();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/MuteWhiteList.php | RongCloud/example/Chatroom/MuteWhiteList.php | <?php
/**
* Chatroom full ban whitelist
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add the chat room's entire ban list to the whitelist
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
"id"=>"chatroom",
"members"=>[
["id"=>"user1"],
["id"=>"user2"],
]
];
$MuteWhiteList = $RongSDK->getChatroom()->MuteWhiteList()->add($chatroom);
Utils::dump("Add the chat room's entire ban list to the whitelist",$MuteWhiteList);
}
add();
/**
* Remove the chat room's global ban whitelist
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
"id"=>"chatroom",
"members"=>[
["id"=>"user3"],
["id"=>"user4"],
]
];
$MuteWhiteList = $RongSDK->getChatroom()->MuteWhiteList()->remove($chatroom);
Utils::dump("Remove the chat room's global ban whitelist",$MuteWhiteList);
}
remove();
/**
* Get the whitelist of the chat room's global mute list
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
"id"=>"chatroom",
];
$MuteWhiteList = $RongSDK->getChatroom()->MuteWhiteList()->getList($chatroom);
Utils::dump("Get the chat room's entire ban list whitelist",$MuteWhiteList);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/Chatroom.php | RongCloud/example/Chatroom/Chatroom.php | <?php
/**
* chatroom
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Create a chat room
*/
function create()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
['id'=> 'phpchatroom4',// Chat room ID
'name'=> 'phpchatroom1']// Chatroom name
];
$result = $RongSDK->getChatroom()->create($chatroom);
Utils::dump("Create a chat room",$result);
}
create();
/**
* Create Chat Room V2
*/
function createV2()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> 'phpchatroom4', // Chat room id
'destroyType'=> 0, // Specifies the destruction type of the chat room 0: default value, indicates destruction when inactive, 1: fixed time destruction
'isBan' => true, // Whether to ban all members of the chat room, default false
'whiteUserIds' => ['user1','user2'] // Forbidden whitelist user list, supports batch settings, maximum not exceeding 20
];
$result = $RongSDK->getChatroom()->createV2($chatroom);
Utils::dump("Create Chat Room V2",$result);
}
createV2();
/**
* Query chat room basic information
*/
function query()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> ['aaa','bbb','ccc'],// @param chatroom id - The unique identifier for the chatroom.
];
$result = $RongSDK->getChatroom()->query($chatroom);
Utils::dump("Query chat room basic information",$result);
}
query();
/**
* Query chat room basic information V2
*/
function queryV2()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = ['id'=> 'aaa'];// Chatroom ID
$result = $RongSDK->getChatroom()->queryV2($chatroom);
Utils::dump("Query the basic information of the chat room V2",$result);
}
queryV2();
/**
* Get chat room members
*/
function get()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> 'phpchatroom4',// Chat room id
'count'=>10,
'order'=>1
];
$result = $RongSDK->getChatroom()->get($chatroom);
Utils::dump("Get chat room members",$result);
}
get();
/**
* Set chat room destruction type
*/
function setDestroyType()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = ['id'=> 'phpchatroom','destroyType'=> 0,'destroyTime'=> 60];// chatroom id
$result = $RongSDK->getChatroom()->setDestroyType($chatroom);
Utils::dump("Set chat room destruction type",$result);
}
setDestroyType();
/**
* Destroy chat room
*/
function destory()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = ['id'=> 'phpchatroom'];// chatroom id
$result = $RongSDK->getChatroom()->destory($chatroom);
Utils::dump("Destroy chat room",$result);
}
destory();
/**
* Check if the user is in the chat room
*/
function isExist()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> 'php chatroom',// Chat room ID
'members'=>[
['id'=>"sea9902"]// @param personnel id
]
];
$result = $RongSDK->getChatroom()->isExist($chatroom);
Utils::dump("Check if the user is in the chat room",$result);
}
isExist();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/Demotion.php | RongCloud/example/Chatroom/Demotion.php | <?php
/**
* Chat room message downgrade
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add in-app chat room downgrade message
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'msgs'=> ['RC:TxtMsg03','RC:TxtMsg02']// Message type list
];
$Demotion = $RongSDK->getChatroom()->Demotion()->add($chatroom);
Utils::dump("Add in-app chat room downgrade message",$Demotion);
}
add();
/**
* Remove application chat room downgrade message
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'msgs'=> ['RC:TxtMsg01','RC:TxtMsg02']// Message type list
];
$Demotion = $RongSDK->getChatroom()->Demotion()->remove($chatroom);
Utils::dump("Remove in-app chat room downgrade message",$Demotion);
}
remove();
/**
* Get the downgrade message within the app chat room
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
];
$Demotion = $RongSDK->getChatroom()->Demotion()->getList($chatroom);
Utils::dump("Get app chat room downgrade message",$Demotion);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/Ban.php | RongCloud/example/Chatroom/Ban.php | <?php
/**
* Mute all chatrooms
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add global chat room ban
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'members'=> [
['id'=>'seal9901']// Personnel ID
],
'minute'=>30// Forbidden duration
];
$Ban = $RongSDK->getChatroom()->Ban()->add($chatroom);
Utils::dump("Add global chat room ban",$Ban);
}
add();
/**
* Unblock global chat room restrictions
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'members'=> [
['id'=>'seal9901']// Person ID
],
];
$Ban = $RongSDK->getChatroom()->Ban()->remove($chatroom);
Utils::dump("Unblock global chat room restrictions",$Ban);
}
remove();
/**
* Get the global banned word list of the chat room
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
];
$Ban = $RongSDK->getChatroom()->Ban()->getList($chatroom);
Utils::dump("Get the global banned word list of the chat room",$Ban);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/Gag.php | RongCloud/example/Chatroom/Gag.php | <?php
/**
* Chatroom member banned speech
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add chat room member mute
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> 'chatroom001',// Chat room id
'members'=> [
['id'=>'seal9901']// Forbidden personnel id
],
'minute'=>30// Forbidden utterance duration
];
$Gag = $RongSDK->getChatroom()->Gag()->add($chatroom);
Utils::dump("Add chat room member mute",$Gag);
}
add();
/**
* Unban chat room member
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> 'ujadk90ha',// Chat room id
'members'=> [
['id'=>'seal9901']// Personnel ID
],
];
$Gag = $RongSDK->getChatroom()->Gag()->remove($chatroom);
Utils::dump("Unban chat room member",$Gag);
}
remove();
/**
* Get the list of muted members in the chat room
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
"id"=>"chatroom001"// chatroom id
];
$Gag = $RongSDK->getChatroom()->Gag()->getList($chatroom);
Utils::dump("Get the list of muted members in the chat room",$Gag);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/Entry.php | RongCloud/example/Chatroom/Entry.php | <?php
/**
* Chat room property settings
*/
use RongCloud\Lib\Utils;
use RongCloud\RongCloud;
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET', '');
/**
* Set chat room attributes (KV)
*/
function set() {
$RongSDK = new RongCloud(APPKEY, APPSECRET);
// Create a chat room
$RongSDK->getChatroom()->create(['id' => 'chatroom001', 'name' => 'RongCloud']);
$params = [
'id' => 'chatroom001',// Chat room ID
'userId' => 'userId01',// Operator User Id
'key' => 'key01',// Chat room attribute name
'value' => 'value01',// The value corresponding to the chat room attribute
];
$Entry = $RongSDK->getChatroom()->Entry()->set($params);
Utils::dump("Set chat room attributes (KV)", $Entry);
}
set();
/**
* Batch set chat room properties (KV)
*/
function batchSet() {
$RongSDK = new RongCloud(APPKEY, APPSECRET);
// Create a chat room
$RongSDK->getChatroom()->createV2(['id' => 'chatroom001']);
$params = [
'id' => 'chatroom001',// Chat room ID
'autoDelete'=> 0, // Whether to delete this key value after the user (entryOwnerId) exits the chat room
'entryOwnerId'=> 'test', // Custom attribute of the chat room's user ID
'entryInfo'=> '{"key1":"value1","key2":"value2"}',// Chat room attribute corresponding value
];
$Entry = $RongSDK->getChatroom()->Entry()->batchSet($params);
Utils::dump("Batch set chat room properties (KV)", $Entry);
}
batchSet();
/**
* Get chat room properties
*/
function query() {
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$params = [
'id' => 'chatroom001',// chatroom id
];
$Entry = $RongSDK->getChatroom()->Entry()->query($params);
Utils::dump("Get chat room properties", $Entry);
}
query();
/**
* Delete chat room attribute
*/
function remove() {
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$params = [
'id' => 'chatroom001',// Chat room id
'userId' => 'userId01',// Operator User ID
'key' => 'key01',// Chat room attribute name
];
$Entry = $RongSDK->getChatroom()->Entry()->remove($params);
Utils::dump("Delete chat room attribute", $Entry);
}
remove(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/Block.php | RongCloud/example/Chatroom/Block.php | <?php
/**
* Chat room personnel ban
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add ban
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> 'OIBbeKlkx',// Chat room id
'members'=> [
['id'=>'aP9uvganV']// Ban member id
],
'minute'=>500// Block duration
];
$Block = $RongSDK->getChatroom()->Block()->add($chatroom);
Utils::dump("Add ban",$Block);
}
add();
/**
* Unblock
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> 'OIBbeKlkx',// Chat room ID
'members'=> [
['id'=>'aP9uvganV']// Unblock member id
],
];
$Block = $RongSDK->getChatroom()->Block()->remove($chatroom);
Utils::dump("Unblock",$Block);
}
remove();
/**
* Query the list of banned members
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=>'OIBbeKlkx'// @param chatroom id
];
$Block = $RongSDK->getChatroom()->Block()->getList($chatroom);
Utils::dump("Query the list of banned members",$Block);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/Keepalive.php | RongCloud/example/Chatroom/Keepalive.php | <?php
/**
* Chatroom Keepalive
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add a chat room for live conversations
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> "Txtmsg03"
];
$Keeplive = $RongSDK->getChatroom()->Keepalive()->add($chatroom);
Utils::dump("Add a chat room for live conversations",$Keeplive);
}
add();
/**
* Delete chat room with keep-alive
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'id'=> "chrmId001"
];
$Keeplive = $RongSDK->getChatroom()->Keepalive()->remove($chatroom);
Utils::dump("Delete chat room with keep-alive",$Keeplive);
}
remove();
/**
* Get the chat room for preservation
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
];
$Keeplive = $RongSDK->getChatroom()->Keepalive()->getList($chatroom);
Utils::dump("Get the chat room for preservation",$Keeplive);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/MuteAllMembers.php | RongCloud/example/Chatroom/MuteAllMembers.php | <?php
/**
* Chatroom-wide ban
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add a chat room-wide ban
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
"id"=>"chatroom"
];
$MuteAllMembers = $RongSDK->getChatroom()->MuteAllMembers()->add($chatroom);
Utils::dump("Add a chat room-wide ban",$MuteAllMembers);
}
add();
/**
* Unmute all participants in the chat room
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
"id"=>"chatroom"
];
$MuteAllMembers = $RongSDK->getChatroom()->MuteAllMembers()->remove($chatroom);
Utils::dump("Unmute all participants in the chat room",$MuteAllMembers);
}
remove();
/**
* Check the status of the entire chat room's mute state
*/
function check()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
"id"=>"chatroom"
];
$MuteAllMembers = $RongSDK->getChatroom()->MuteAllMembers()->check($chatroom);
Utils::dump("Check the status of the entire chat room's mute state",$MuteAllMembers);
}
check();
/**
* Get the list of all banned words in the chat room
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$MuteAllMembers = $RongSDK->getChatroom()->MuteAllMembers()->getList(1, 50);
Utils::dump("Get the list of all banned words in the chat room",$MuteAllMembers);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/Whitelist/User.php | RongCloud/example/Chatroom/Whitelist/User.php | <?php
/**
* Chat Room Module User Whitelist Instance
*/
require "./../../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add chat room user whitelist
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
"id"=>"seal9901",// Chat room ID
"members"=>[
["id"=>"user1"],// User ID
["id"=>"user2"]
]
];
$User = $RongSDK->getChatroom()->Whitelist()->User()->add($chatroom);
Utils::dump("Add chat room user whitelist",$User);
}
add();
/**
* Remove chat room user whitelist
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
"id"=>"seal9901",// Chat room ID
"members"=>[
["id"=>"user4"],// User ID
["id"=>"user5"]
]
];
$User = $RongSDK->getChatroom()->Whitelist()->User()->remove($chatroom);
Utils::dump("Remove chat room user whitelist",$User);
}
remove();
/**
* Get the chat room user whitelist
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
"id"=>"seal9901",// chatroom id
];
$User = $RongSDK->getChatroom()->Whitelist()->User()->getList($chatroom);
Utils::dump("Get the chat room user whitelist",$User);
}
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Chatroom/Whitelist/Message.php | RongCloud/example/Chatroom/Whitelist/Message.php | <?php
/**
* Chat room message whitelist instance
*/
require "./../../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add chat room message whitelist
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'msgs'=> ["RC:TxtMsg"]// Message type list
];
$Message = $RongSDK->getChatroom()->Whitelist()->Message()->add($chatroom);
Utils::dump("Add chat room message whitelist",$Message);
}
add();
/**
* Get the chat room message whitelist
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
];
$Message = $RongSDK->getChatroom()->Whitelist()->Message()->getList($chatroom);
Utils::dump("Get the chat room message whitelist",$Message);
}
getList();
/**
* Remove chat room message whitelist
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$chatroom = [
'msgs'=> ["RC:TxtMsg"]// Message type list
];
$Message = $RongSDK->getChatroom()->Whitelist()->Message()->remove($chatroom);
Utils::dump("Remove chat room message whitelist",$Message);
}
remove(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Ultragroup/Expansion.php | RongCloud/example/Ultragroup/Expansion.php | <?php
/**
* Supercluster module supercluster expansion message
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
$RongSDK = new RongCloud(APPKEY,APPSECRET);
/**
* Message Sending
*/
function set()
{
// Connect to Singapore Data Center
// RongCloud::$apiUrl = ['http://api.sg-light-api.com/'];
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'msgUID' => 'BS45-NPH4-HV87-10LM', // The unique message identifier, which the server can obtain through the full message routing function.
'userId' => 'WNYZbMqpH', // The user ID for extended message delivery needs to be set.
'groupId' => 'tjw3zbMrU', // Super group ID
'busChannel' => '', // Channel ID can be empty
'extraKeyVal' => ['type1' => '1', 'type2' => '2', 'type3' => '3', 'type4' => '4',]// Custom message extension content, JSON structure, set in Key-Value format
];
$res = $RongSDK->getUltragroup()->Expansion()->set($message);
Utils::dump("Message Sending", $res);
}
set();
function delete()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'msgUID' => 'BS45-NPH4-HV87-10LM', // The unique message identifier ID, which the server can obtain through the full message routing function.
'userId' => 'WNYZbMqpH', // Need to set the extended message sending user Id.
'groupId' => 'tjw3zbMrU', // Super group ID
'busChannel' => '', // The channel ID can be empty
'extraKey' => ['type1', 'type2'] // The Key value of the extension information to be deleted, with a maximum of 100 extension information items that can be deleted at once
];
$res = $RongSDK->getUltragroup()->Expansion()->delete($message);
Utils::dump("delete", $res);
}
delete();
/**
* Get supergroup extension message
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY, APPSECRET);
$message = [
'msgUID' => 'BS45-NPH4-HV87-10LM', // The unique message identifier ID, which can be obtained by the server through the full message routing function.
'groupId'=>"aaa" ,// Super cluster ID
'busChannel'=>"aaa" ,// Super Group Channel
'pageNo' => 1 // Page count, defaults to returning 300 extended information.
];
$res = $RongSDK->getUltragroup()->Expansion()->getList($message);
Utils::dump("Get supergroup extension message", $res);
}
getList();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Ultragroup/MuteWhiteList.php | RongCloud/example/Ultragroup/MuteWhiteList.php | <?php
/**
* Super group ban whitelist whitelist instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add super group ban whitelist
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
'members'=>[// Forbidden whitelist personnel list
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
,
];
$result = $RongSDK->getUltragroup()->MuteWhiteList()->add($group);
Utils::dump("Add super group ban whitelist",$result);
}
add();
/**
* Query the list of members in the forbidden word whitelist
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Ultra group ID
];
$result = $RongSDK->getUltragroup()->MuteWhiteList()->getList($group);
Utils::dump("Query the list of members in the forbidden word whitelist",$result);
}
getList();
/**
* Remove the denylist whitelist
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
'members'=>[ //Unblock whitelisted personnel list
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
];
$result = $RongSDK->getUltragroup()->MuteWhiteList()->remove($group);
Utils::dump("Remove the denylist whitelist",$result);
}
remove();
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Ultragroup/Notdisturb.php | RongCloud/example/Ultragroup/Notdisturb.php | <?php
/**
* Supergroup mute notifications
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Set super group do not disturb
*/
function set()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
'busChannel'=>"",
"unpushLevel"=>1
// Do Not Disturb Level
// -1: All message notifications
// 0: Not set (When the user has not set this state, it is the default state for all notifications. In this state, if a super group default state is set, the super group's default settings will be used as the standard)
// 1: Only notify for @ messages, including @specific users and @everyone
// Only notify the specified user with @, and only notify the user specified by @.
//@Zhang San will receive the push notification, @all will not receive the push notification.
// This is a sample comment
/*
* This is a multi-line comment
* @param {string} input - The input string to process
*/
// Only notify @all members, and only receive push messages from @everyone
// 5: No notifications will be received, even if it is an @ message.
];
$result = $RongSDK->getUltragroup()->Notdisturb()->set($group);
Utils::dump("Set super group do not disturb",$result);
}
set();
/**
* Query super group mute
*/
function get()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
'busChannel'=>"",
];
$result = $RongSDK->getUltragroup()->Notdisturb()->get($group);
Utils::dump("Query super group mute",$result);
}
get();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Ultragroup/BusChannel.php | RongCloud/example/Ultragroup/BusChannel.php | <?php
/**
* Super group channel instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Super group channel creation
*/
function create()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
'busChannel'=> 'busChannel',// Super Group Channel
'type'=>1
];
$result = $RongSDK->getUltragroup()->BusChannel()->add($group);
Utils::dump("Super group channel creation",$result);
}
create();
function change()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super Group ID
'busChannel'=> 'busChannel',// Super Group Channel
'type'=>1
];
$result = $RongSDK->getUltragroup()->BusChannel()->change($group);
Utils::dump("change",$result);
}
change();
/**
* Super group channel acquisition
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$result = $RongSDK->getUltragroup()->BusChannel()->getList("phpgroup2");
Utils::dump("Super group channel acquisition",$result);
}
getList();
/**
* Super group channel deletion
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Supergroup ID
'busChannel'=> 'busChannel',// Super Group Channel
];
$result = $RongSDK->getUltragroup()->BusChannel()->remove($group);
Utils::dump("Super group channel deletion",$result);
}
remove();
getList();
/* /**
* Add supergroup private channel member
*/
function addPrivateUsers()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
'busChannel'=>'',
'members'=>[// Add super group private channel member
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
];
$result = $RongSDK->getUltragroup()->BusChannel()->addPrivateUsers($group);
Utils::dump("Add supergroup private channel member",$result);
}
addPrivateUsers();
/**
* Query the list of members in the super private channel
*/
function getPrivateUserList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup2',// Super Group ID
'busChannel'=>'',
'page'=>1,
'pageSize'=>100
];
$result = $RongSDK->getUltragroup()->BusChannel()->getPrivateUserList($group);
Utils::dump("Query the list of members in the super private channel",$result);
}
getPrivateUserList();
/**
* Remove members from the super private channel
*/
function removePrivateUsers()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Supergroup ID
'busChannel'=>'',
'members'=>[// Remove supergroup private channel member
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
];
$result = $RongSDK->getUltragroup()->BusChannel()->removePrivateUsers($group);
Utils::dump("Remove members from the super private channel",$result);
}
removePrivateUsers();
getPrivateUserList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Ultragroup/Gag.php | RongCloud/example/Ultragroup/Gag.php | <?php
/**
* Supergroup ban example
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Add super group ban speech
*/
function add()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Supergroup ID
'members'=>[// Forbidden personnel list
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
,
'minute'=>3000 // Forbidden utterance duration
];
$result = $RongSDK->getUltragroup()->Gag()->add($group);
Utils::dump("Add super group ban speech",$result);
}
add();
/**
* Query the list of banned members
*/
function getList()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Ultra Group ID
];
$result = $RongSDK->getUltragroup()->Gag()->getList($group);
Utils::dump("Query the list of banned members",$result);
}
getList();
/**
* Lift the ban
*/
function remove()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Supergroup ID
'members'=>[// Unban user list
['id'=> 'Vu-oC0_LQ6kgPqltm_zYtI']
]
];
$result = $RongSDK->getUltragroup()->Gag()->remove($group);
Utils::dump("Lift the ban",$result);
}
remove();
getList(); | php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Ultragroup/MuteAllMembers.php | RongCloud/example/Ultragroup/MuteAllMembers.php | <?php
/**
* Specify a supergroup member ban instance
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Set supergroup ban
*/
function set()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
"status"=>1
];
$result = $RongSDK->getUltragroup()->MuteAllMembers()->set($group);
Utils::dump("Set supergroup ban",$result);
}
set();
/**
* Query the status of super group bans
*/
function get()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Ultra group ID
];
$result = $RongSDK->getUltragroup()->MuteAllMembers()->get($group);
Utils::dump("Query the status of super group bans",$result);
}
get();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
rongcloud/server-sdk-php | https://github.com/rongcloud/server-sdk-php/blob/590bd7c0699a341347a180147fc96509393bb9d4/RongCloud/example/Ultragroup/Ultragroup.php | RongCloud/example/Ultragroup/Ultragroup.php | <?php
/**
* Super cluster module
*/
require "./../../RongCloud.php";
define("APPKEY", '');
define('APPSECRET','');
use RongCloud\RongCloud;
use RongCloud\Lib\Utils;
/**
* Create a super group
*/
function create()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
'name'=> 'watergroup',// Supergroup Name
'member'=>['id'=> 'group999'],// Create a userId
];
$result = $RongSDK->getUltragroup()->create($group);
Utils::dump("Create a super group",$result);
}
create();
/**
* Join the super group
*/
function joins()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
'member'=>['id'=> 'group999'],// Group member information
];
$result = $RongSDK->getUltragroup()->joins($group);
Utils::dump("Join the super group",$result);
}
joins();
/**
* Exit super group
*/
function quit()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
'member'=>['id'=> 'uPj70HUrRSUk-ixtt7iIGc']// Exit personnel information
];
$result = $RongSDK->getUltragroup()->quit($group);
Utils::dump("Exit super group",$result);
}
quit();
/**
* Disassemble super cluster
*/
function dismiss()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Ultra group ID
];
$result = $RongSDK->getUltragroup()->dismiss($group);
Utils::dump("Disassemble super cluster",$result);
}
dismiss();
/**
* Modify group information
*/
function update()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Supergroup ID
'name'=>"watergroup"// group name
];
$result = $RongSDK->getUltragroup()->update($group);
Utils::dump("Modify group information",$result);
}
update();
/**
* Whether the group member exists
*/
function isExist()
{
$RongSDK = new RongCloud(APPKEY,APPSECRET);
$group = [
'id'=> 'phpgroup1',// Super group ID
'member'=>"userId1"// Member ID
];
$result = $RongSDK->getUltragroup()->isExist($group);
Utils::dump("Whether the group member exists ",$result);
}
isExist();
| php | MIT | 590bd7c0699a341347a180147fc96509393bb9d4 | 2026-01-05T05:06:12.177745Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/.github/scripts/translation/extractTranslationFromSql.php | .github/scripts/translation/extractTranslationFromSql.php | #!/usr/bin/env php
<?php
# $PHP $BASE_DIR/extractTranslationFromSql.php > $BASE_DIR_PROJECT/www/install/menu_translation.php
if ($argc < 2) {
echo "Usage: php {$argv[0]} <SQL file to analyse>\n";
exit(1);
}
if (is_file($_SERVER['argv'][1])) {
$file = $_SERVER['argv'][1];
} else {
echo "{$argv[1]} if not a file\n";
echo "Usage: php {$argv[0]} <SQL file to analyse>\n";
exit(1);
}
try {
$content = file($file);
if ($content === false) {
echo "Failed to read file $file\n";
exit(1);
}
} catch (Exception $e) {
echo "Error reading file $file: " . $e->getMessage() . "\n";
exit(1);
}
if (empty($content)) {
echo "File $file is empty\n";
exit(1);
}
$data = [];
if (strcmp(basename($file), "insertBaseConf.sql") == 0) {
$startBrokerAnalisys = false;
$brokerPattern1 = "/INSERT INTO `cb_field` \(`cb_field_id`, `fieldname`, `displayname`, `description`, `fieldtype`, `external`\) VALUES/";
$brokerPattern2 = "/INSERT INTO `cb_field` \(`cb_field_id`, `fieldname`, `displayname`, `description`, `fieldtype`, `external`, `cb_fieldgroup_id`\) VALUES/";
$brokerPattern3 = "/INSERT INTO `cb_fieldgroup` \(`cb_fieldgroup_id`, `groupname`, `displayname`, `multiple`, `group_parent_id`\) VALUES/";
foreach ($content as $line) {
if (empty($line) || preg_match('/^\s/', $line)) {
$startBrokerAnalisys = false;
}
if ($startBrokerAnalisys) {
$values = explode(',', $line);
if (isset($values[2])) {
$data[$values[2]] = $values[2];
}
}
if (
preg_match($brokerPattern1 , $line) || preg_match($brokerPattern2, $line) || preg_match($brokerPattern3, $line)
) {
$startBrokerAnalisys = true;
}
}
} elseif (strcmp(basename($file), "insertTopology.sql") == 0) {
$topologyPattern1 = "/INSERT INTO `topology` \(.*\) VALUES/";
$topologyPattern2 = "/\(NULL.*\)/";
foreach ($content as $line) {
if (preg_match($topologyPattern1, $line)) {
$aSqlValues = explode('VALUES', $line);
# Removing parentheses
$openPos = strpos($aSqlValues[1], '(');
$closePos = strpos($aSqlValues[1], ')');
if ($openPos !== false && $closePos !== false) {
$aSqlValues[1] = substr(
$aSqlValues[1],
$openPos + 1,
$closePos - $openPos - 1
);
} else {
// Handle case where parentheses are not found
continue;
}
# Removing spaces before and after
$aSqlValues[1] = trim($aSqlValues[1]);
$aValues = explode(',', $aSqlValues[1]);
# If array is not empty
if (count($aValues)) {
if (
preg_match('/NULL/', trim($aValues[0]))
|| preg_match('/\d+/', trim($aValues[0]))
) {
$data[$aValues[1]] = $aValues[1];
} else {
$data[$aValues[0]] = $aValues[0];
}
}
} elseif (preg_match($topologyPattern2, $line)) {
$aValues = explode(',', $line);
if (count($aValues)) {
if (
preg_match('/NULL/', trim($aValues[0]))
|| preg_match('/\d+/', trim($aValues[0]))
) {
$data[$aValues[1]] = $aValues[1];
} else {
$data[$aValues[0]] = $aValues[0];
}
}
}
}
} elseif (strcmp(basename($file), "install.sql") == 0) {
$topologyPattern = "/INSERT INTO `topology` \(.*\) VALUES/";
$startBrokerAnalisys = false;
foreach ($content as $line) {
if (empty($line) || preg_match('/^\s/', $line)) {
$startBrokerAnalisys = false;
}
if ($startBrokerAnalisys) {
$line = substr($line, strpos($line, '(') + 1, strpos($line, ')'));
# Removing spaces before and after
$line = trim($line);
$aValues = explode(',', $line);
if (count($aValues)) {
if (
preg_match('/NULL/', trim($aValues[0]))
|| preg_match('/\d+/', trim($aValues[0]))
) {
$data[$aValues[1]] = $aValues[1];
} else {
$data[$aValues[0]] = $aValues[0];
}
}
}
if (preg_match($topologyPattern , $line)){
$startBrokerAnalisys = true;
}
}
}
if (count($data) > 0) {
echo "<?php\n";
foreach ($data as $key => $value) {
if (!empty(trim($key))) {
echo '_(' . trim($key) .');' . "\n";
}
}
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/.github/scripts/translation/extractTranslationFromTypescript.php | .github/scripts/translation/extractTranslationFromTypescript.php | #!/usr/bin/env php
<?php
// extensions of ReactJS files, used when going through a directory
$extensions = ['ts', 'tsx'];
// rips gettext strings from $file and prints them in C format
function do_file($file)
{
$content = @file_get_contents($file);
if (empty($content)) {
return;
}
preg_match_all("/export\sconst\slabel.*\s=\n?\s+(?:'|\"|`)(.+)(?:'|\"|`);/", $content, $matches);
if (count($matches[0]) > 0) {
echo "/* $file */\n";
}
for ($i=0; $i < count($matches[0]); $i++) {
echo '_("' . trim($matches[1][$i],'\'"') .'");' . "\n";
}
}
// go through a directory
function do_dir($dir)
{
$d = dir($dir);
while (false !== ($entry = $d->read())) {
if ($entry == '.' || $entry == '..') {
continue;
}
$entry = $dir . '/' . $entry;
if (is_dir($entry)) { // if a directory, go through it
do_dir($entry);
} else { // if file, parse only if extension is matched
$pi = pathinfo($entry);
if (isset($pi['extension']) && in_array($pi['extension'], $GLOBALS['extensions'])) {
do_file($entry);
}
}
}
$d->close();
}
echo "<?php\n";
for ($ac=1; $ac < $_SERVER['argc']; $ac++) {
if (is_dir($_SERVER['argv'][$ac])) { // go through directory
do_dir($_SERVER['argv'][$ac]);
} else { // do file
do_file($_SERVER['argv'][$ac]);
}
}
if ($argc < 2) {
echo "Usage: {$argv[0]} CENTREON_WWW/ > output.php\n";
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/.github/scripts/translation/extractTranslationFromDashboardProperties.php | .github/scripts/translation/extractTranslationFromDashboardProperties.php | #!/usr/bin/env php
<?php
/**
* Function to extract strings to translate from Dashboard widgets properties.json files
*/
function extractValues($array, $keys = ["title", "description", "label", "secondaryLabel", "name"], &$results = []) {
foreach ($array as $key => $value) {
if (in_array($key, $keys) && is_string($value)) {
$results[$value] = $value;
} elseif (is_array($value)) {
extractValues($value, $keys, $results);
}
}
return $results;
}
if ($argc < 2) {
echo "Usage: php {$argv[0]} <centreon-web directory>\n";
exit(1);
}
if (is_dir($_SERVER['argv'][1])) {
$centeonDir = $_SERVER['argv'][1];
} else {
echo "{$argv[1]} if not a dir\n";
echo "Usage: php {$argv[0]} <centreon-web directory>\n";
exit(1);
}
$dir = $centeonDir . "/www/front_src/src/Dashboards/SingleInstancePage/Dashboard/Widgets";
if ( ! is_dir($dir)) {
echo "{$argv[1]} if not a the centreon-web dir\n";
echo "Usage: php {$argv[0]} <centreon-web directory>\n";
exit(1);
}
$d = dir($dir);
$data = [];
while (false !== ($entry = $d->read())) {
if ($entry == '.' || $entry == '..') {
continue;
}
$entry = $dir.'/'.$entry;
$propertiesJsonFile = $entry . '/properties.json';
if (is_dir($entry) && is_file($propertiesJsonFile)) {
$jsonData = @file_get_contents($propertiesJsonFile);
if (empty($jsonData)) {
continue;
}
$dataArray = json_decode($jsonData, true);
$data = array_merge($data, extractValues($dataArray));
}
}
$d->close();
if (count($data) > 0) {
echo "<?php\n";
foreach ($data as $key => $value) {
if (!empty(trim($key))) {
echo '_("' . trim($key) .'");' ."\n";
}
}
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/.github/scripts/translation/extractTranslationFromSmartyTemplate.php | .github/scripts/translation/extractTranslationFromSmartyTemplate.php | #!/usr/bin/env php
<?php
/**
* tsmarty2c.php - rips gettext strings from smarty template
*
* ------------------------------------------------------------------------- *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
* ------------------------------------------------------------------------- *
*
* This command line script rips gettext strings from smarty file,
* and prints them to stdout in C format, that can later be used with the
* standard gettext tools.
*
* Usage:
* ./tsmarty2centreon <filename or directory> <file2> <..> > smarty.c
*
* If a parameter is a directory, the template files within will be parsed.
*
* Script modified by <sho@merethis.com>
*
* @package smarty-gettext
* @version $Id: tsmarty2c.php,v 1.3 2005/07/27 17:59:39 sagi Exp $
* @link http://smarty-gettext.sf.net/
* @author Sagi Bashari <sagi@boom.org.il>
* @copyright 2004-2005 Sagi Bashari
*/
// smarty open tag
$ldq = preg_quote('{');
// smarty close tag
$rdq = preg_quote('}');
// smarty command
$cmd = preg_quote('t');
// extensions of smarty files, used when going through a directory
$extensions = array('tpl', 'ihtml', 'html');
// "fix" string - strip slashes, escape and convert new lines to \n
function fs($str)
{
$str = stripslashes($str);
$str = str_replace('"', '\"', $str);
$str = str_replace("\n", '\n', $str);
return $str;
}
// rips gettext strings from $file and prints them in C format
function do_file($file)
{
$content = @file_get_contents($file);
if (empty($content)) {
return;
}
global $ldq, $rdq, $cmd;
preg_match_all(
"/{$ldq}\s*({$cmd})\s*([^{$rdq}]*){$rdq}([^{$ldq}]*){$ldq}\/\\1{$rdq}/",
$content,
$matches
);
for ($i=0; $i < count($matches[0]); $i++) {
// TODO: add line number
echo "/* $file */\n"; // credit: Mike van Lammeren 2005-02-14
if (preg_match('/plural\s*=\s*["\']?\s*(.[^\"\']*)\s*["\']?/', $matches[2][$i], $match)) {
echo 'ngettext("'.fs($matches[3][$i]).'","'.fs($match[1]).'",x);'."\n";
} else {
echo '_("'.fs($matches[3][$i]).'");'."\n";
}
echo "\n";
}
}
// go through a directory
function do_dir($dir)
{
$d = dir($dir);
while (false !== ($entry = $d->read())) {
if ($entry == '.' || $entry == '..') {
continue;
}
$entry = $dir.'/'.$entry;
if (is_dir($entry)) { // if a directory, go through it
do_dir($entry);
} else { // if file, parse only if extension is matched
$pi = pathinfo($entry);
if (isset($pi['extension']) && in_array($pi['extension'], $GLOBALS['extensions'])) {
do_file($entry);
}
}
}
$d->close();
}
echo "<?php\n";
for ($ac=1; $ac < $_SERVER['argc']; $ac++) {
if (is_dir($_SERVER['argv'][$ac])) { // go through directory
do_dir($_SERVER['argv'][$ac]);
} else { // do file
do_file($_SERVER['argv'][$ac]);
}
}
if ($argc < 2) {
echo "Usage: {$argv[0]} CENTREON_WWW/ > output.php\n";
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/.github/docker/install-centreon-module.php | .github/docker/install-centreon-module.php | #!/usr/bin/env php
<?php
function help()
{
echo "install-centreon-module.php -b <bootstrap_file> -m <module_name> [-h]\n\n";
}
$options = getopt("b:m:hu");
if (isset($options['h']) && false === $options['h']) {
help();
exit(0);
}
if (false === isset($options['b']) || false === isset($options['m'])) {
echo "Missing arguments.\n";
exit(1);
}
if (false === file_exists($options['b'])) {
echo "The configuration doesn't exist.\n";
exit(1);
}
require_once $options['b'];
if (!defined('_CENTREON_PATH_')) {
echo "Centreon configuration not loaded.\n";
exit(1);
}
if (false == is_dir(_CENTREON_PATH_ . '/www/modules/' . $options['m'])) {
echo "The module directory is not installed on filesystem.\n";
exit(1);
}
$utilsFactory = new \CentreonLegacy\Core\Utils\Factory($dependencyInjector);
$utils = $utilsFactory->newUtils();
$factory = new \CentreonLegacy\Core\Module\Factory($dependencyInjector, $utils);
$information = $factory->newInformation();
$installedInformation = $information->getInstalledInformation($options['m']);
if (!isset($options['u']) && $installedInformation) {
echo "The module is already installed in database.\n";
exit(1);
} elseif (isset($options['u']) && false === $options['u'] && !$installedInformation) {
echo "The module is not installed in database.\n";
exit(1);
}
if (isset($options['u']) && false === $options['u']) {
$upgrader = $factory->newUpgrader($options['m'], $installedInformation['id']);
$upgrader->upgrade();
} else {
$installer = $factory->newInstaller($options['m']);
$installer->install();
} | php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/.github/docker/centreon-web/scripts/install-centreon-widget.php | .github/docker/centreon-web/scripts/install-centreon-widget.php | #!/usr/bin/env php
<?php
function help()
{
echo "install-centreon-widget.php -b <bootstrap_file> -w <widget_name> [-h]\n\n";
}
$options = getopt("b:w:hu");
if (isset($options['h']) && false === $options['h']) {
help();
exit(0);
}
if (false === isset($options['b']) || false === isset($options['w'])) {
echo "Missing arguments.\n";
exit(1);
}
if (false === file_exists($options['b'])) {
echo "The configuration doesn't exist.\n";
exit(1);
}
require_once $options['b'];
if (!defined('_CENTREON_PATH_')) {
echo "Centreon configuration not loaded.\n";
exit(1);
}
if (false == is_dir(_CENTREON_PATH_ . '/www/widgets/' . $options['w'])) {
echo "The widget directory is not installed on filesystem.\n";
exit(1);
}
$utilsFactory = new \CentreonLegacy\Core\Utils\Factory($dependencyInjector);
$utils = $utilsFactory->newUtils();
$factory = new \CentreonLegacy\Core\Widget\Factory($dependencyInjector, $utils);
$information = $factory->newInformation();
$isInstalled = $information->isInstalled($options['w']);
if (!isset($options['u']) && $isInstalled) {
echo "The widget is already installed in database.\n";
exit(1);
} elseif (isset($options['u']) && false === $options['u'] && !$isInstalled) {
echo "The widget is not installed in database.\n";
exit(1);
}
if (isset($options['u']) && false === $options['u']) {
$upgrader = $factory->newUpgrader($options['w']);
$upgrader->upgrade();
} else {
$installer = $factory->newInstaller($options['w']);
$installer->install();
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/.php-cs-fixer.php | php-tools/.php-cs-fixer.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
use PhpCsFixer\Finder;
use Tools\PhpCsFixer\PhpCsFixerRuleSet;
$config = require_once __DIR__ . '/../php-tools/php-cs-fixer/config/base.strict.php';
$finder = Finder::create()
->in([
__DIR__ . '/php-cs-fixer/',
__DIR__ . '/phpstan/',
__DIR__ . '/rector/',
])
->append([
__DIR__ . '/.php-cs-fixer.php',
__DIR__ . '/rector.php',
]);
return $config
->setRules(array_merge(
PhpCsFixerRuleSet::getRules(),
[
'psr_autoloading' => false, // This rule is not compatible with php-tools directory architecture
]
))
->setFinder($finder)
->setCacheFile('.php-cs-fixer.cache');
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/rector.php | php-tools/rector.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
$rectorConfig = require_once __DIR__ . '/rector/config/base.strict.php';
return $rectorConfig
->withCache(__DIR__ . '/var/cache/rector.tools')
->withPaths([
// directories
__DIR__ . '/php-cs-fixer',
__DIR__ . '/phpstan',
__DIR__ . '/rector',
// files
__DIR__ . '/.php-cs-fixer.php',
__DIR__ . '/rector.php',
]);
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/php-cs-fixer/src/PhpCsFixerRuleSet.php | php-tools/php-cs-fixer/src/PhpCsFixerRuleSet.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
namespace Tools\PhpCsFixer;
class PhpCsFixerRuleSet
{
/**
* This method returns an array of defined rules Php-Cs-Fixer.
*
* @return array<string, array<string, mixed>|bool>
*/
public static function getRules(): array
{
return self::getRulesSafe() + self::getRulesRisky();
}
/**
* This method returns an array of defined Php-Cs-Fixer rules which MUST NOT be risky.
*
* @return array<string, array<string, mixed>|bool>
*/
public static function getRulesSafe(): array
{
return [
'@PSR12' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => true,
'assign_null_coalescing_to_coalesce_equal' => true,
'backtick_to_shell_exec' => true,
'blank_line_before_statement' => ['statements' => ['exit', 'return', 'throw', 'yield']],
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => [
'method' => 'one',
'property' => 'one',
'const' => 'only_if_meta',
'trait_import' => 'none',
'case' => 'none',
],
],
'clean_namespace' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'concat_space' => ['spacing' => 'one'],
'declare_parentheses' => true,
'declare_strict_types' => false,
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'fully_qualified_strict_types' => true,
'general_phpdoc_tag_rename' => ['case_sensitive' => true, 'replacements' => ['inheritdoc' => 'inheritDoc']],
'header_comment' => [
'header' => self::getLicenseHeaderAsPhpComment(),
'location' => 'after_open',
'separate' => 'both',
'comment_type' => 'comment',
],
'heredoc_indentation' => true,
'heredoc_to_nowdoc' => true,
'include' => true,
'lambda_not_used_import' => true,
'list_syntax' => true,
'native_function_invocation' => false,
'method_argument_space' => ['on_multiline' => 'ignore'],
'method_chaining_indentation' => true,
'multiline_whitespace_before_semicolons' => true,
'no_alias_language_construct_call' => true,
'no_alternative_syntax' => true,
'no_binary_string' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => [
'tokens' => [
'break',
'case',
'continue',
'default',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'switch',
'throw',
],
],
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline' => [
'elements' => [
'arguments',
'array',
'array_destructuring',
'group_import',
],
],
'no_unneeded_control_parentheses' => true,
'no_unneeded_braces' => true,
'no_unneeded_import_alias' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_whitespace_before_comma_in_array' => true,
'normalize_index_brace' => true,
'not_operator_with_successor_space' => true,
'nullable_type_declaration_for_default_null_value' => true,
'object_operator_without_whitespace' => true,
'operator_linebreak' => true,
'ordered_imports' => ['imports_order' => ['const', 'class', 'function'], 'sort_algorithm' => 'alpha'],
'phpdoc_add_missing_param_annotation' => ['only_untyped' => true],
'phpdoc_align' => ['align' => 'left'],
'phpdoc_annotation_without_dot' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag_normalizer' => true,
'phpdoc_line_span' => ['const' => null, 'property' => 'single'],
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => true,
'phpdoc_return_self_reference' => ['replacements' => ['this' => 'self', '@this' => 'self']],
'phpdoc_scalar' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_to_comment' => false,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => true,
'phpdoc_var_annotation_correct_order' => true,
'phpdoc_var_without_name' => true,
'return_assignment' => true,
'self_static_accessor' => true,
'semicolon_after_instruction' => true,
'simple_to_complex_string_variable' => true,
'simplified_if_return' => true,
'single_line_comment_spacing' => true,
'single_line_comment_style' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_increment' => true,
'standardize_not_equals' => true,
'switch_continue_to_break' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline' => [
'after_heredoc' => true,
'elements' => ['array_destructuring', 'arrays', 'match', 'parameters'],
],
'trim_array_spaces' => true,
'type_declaration_spaces' => true,
'types_spaces' => true,
'whitespace_after_comma_in_array' => true,
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
'ordered_class_elements' => true,
];
}
/**
* This method returns an array of defined Php-Cs-Fixer rules which are considered risky.
*
* @return array<string, array<string, mixed>|bool>
*/
public static function getRulesRisky(): array
{
return [
'array_push' => true,
'combine_nested_dirname' => true,
'declare_strict_types' => true,
'dir_constant' => true,
'fopen_flag_order' => true,
'function_to_constant' => true,
'get_class_to_class_keyword' => true,
'implode_call' => true,
'logical_operators' => true,
'mb_str_functions' => true,
'modernize_strpos' => true,
'modernize_types_casting' => true,
'no_alias_functions' => true,
'no_homoglyph_names' => true,
'no_trailing_whitespace_in_string' => true,
'no_unreachable_default_argument_value' => true,
'no_unset_on_property' => true,
'no_useless_sprintf' => true,
'psr_autoloading' => ['dir' => './src'],
'random_api_migration' => true,
'regular_callable_call' => true,
'self_accessor' => true,
'set_type_to_cast' => true,
'strict_comparison' => true,
'strict_param' => true,
'string_line_ending' => true,
'use_arrow_functions' => true,
'void_return' => true,
];
}
/**
* This method returns the license header as a PHP comment.
*/
private static function getLicenseHeaderAsPhpComment(): string
{
$year = 2025;
return <<<"EOF"
Copyright 2005 - {$year} Centreon (https://www.centreon.com/)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For more information : contact@centreon.com
EOF;
}
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/php-cs-fixer/src/Command/RunCsFixerOnDiffCommand.php | php-tools/php-cs-fixer/src/Command/RunCsFixerOnDiffCommand.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
namespace Tools\PhpCsFixer\Command;
use Webmozart\Assert\Assert;
use Webmozart\Assert\InvalidArgumentException;
final readonly class RunCsFixerOnDiffCommand
{
/**
* @param array<string> $sections
* @param array<string, array{files: array<string>, directories: array<string>, skip: array<string>}> $pathsConfig
* @param array<int, string> $args
*
* @throws InvalidArgumentException
*/
public function __construct(
public string $moduleName,
public array $sections,
public array $pathsConfig,
public array $args,
) {
Assert::notEmpty($moduleName, 'Module name must be provided');
Assert::notEmpty($sections, 'At least one section must be provided');
Assert::notEmpty($pathsConfig, 'Paths configuration must be provided');
Assert::notEmpty($args, 'Arguments must be provided');
Assert::allString($sections, 'Sections must be strings');
Assert::allString($args, 'Arguments must be strings');
Assert::allInArray($sections, array_keys($pathsConfig), 'One or more sections are not present in paths configuration');
foreach ($pathsConfig as $config) {
Assert::keyExists($config, 'files', 'Each config must have the "files" key');
Assert::keyExists($config, 'directories', 'Each config must have the "directories" key');
Assert::keyExists($config, 'skip', 'Each config must have the "skip" key');
}
}
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/php-cs-fixer/src/Command/RunCsFixerOnDiffCommandHandler.php | php-tools/php-cs-fixer/src/Command/RunCsFixerOnDiffCommandHandler.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
namespace Tools\PhpCsFixer\Command;
final class RunCsFixerOnDiffCommandHandler
{
public function run(RunCsFixerOnDiffCommand $command): void
{
$args = $command->args;
$toFix = true;
if (in_array('--dry-run', $args, true)) {
$toFix = false;
}
echo '################################################' . PHP_EOL;
echo '=> Preparing files to analyse' . PHP_EOL;
$diffFiles = [];
foreach ($args as $key => $arg) {
if (str_starts_with($arg, $command->moduleName . '/') && str_ends_with($arg, '.php')) {
$replacement = preg_replace('/^' . preg_quote($command->moduleName . '/', '/') . '/', '', $arg);
if ($replacement === null) {
echo '⚠️ Error processing file when removing module name: ' . $arg . PHP_EOL;
exit(1);
}
$diffFiles[] = $replacement;
}
if (str_starts_with($arg, $command->moduleName . '/')) {
unset($args[$key]);
}
}
if ($diffFiles === []) {
echo 'No files to analyse!' . PHP_EOL;
exit(0);
}
$pathsToAnalyze = [];
foreach ($command->sections as $section) {
$pathsToAnalyze[$section] = [];
}
foreach ($diffFiles as $file) {
$matched = false;
foreach (array_keys($pathsToAnalyze) as $section) {
if ($this->matchesConfig($file, $command->pathsConfig[$section])) {
$pathsToAnalyze[$section][] = $file;
$matched = true;
break;
}
}
if (! $matched) {
echo '⚠️ File not recognised: ' . $file . PHP_EOL;
}
}
$hasErrors = false;
foreach ($pathsToAnalyze as $section => $files) {
$exitCode = $this->executeCsFixer("cs:{$section}", $files, $toFix);
if (! $hasErrors && $exitCode !== 0) {
$hasErrors = true;
}
}
($hasErrors) ? exit(1) : exit(0);
}
/**
* @param array{files: array<string>, directories: array<string>, skip: array<string>} $config
*/
private function matchesConfig(string $file, array $config): bool
{
return array_filter(
array_merge($config['directories'], $config['files']),
fn ($path): bool => str_starts_with($file, $path)
) !== []
&& array_filter(
$config['skip'],
fn ($skip): bool => str_starts_with($file, $skip)
) === [];
}
/**
* @param array<int,string> $filesToAnalyze
*/
private function executeCsFixer(string $commandName, array $filesToAnalyze, bool $toFix): int
{
echo '################################################' . PHP_EOL;
echo '=> Running ' . $commandName . PHP_EOL;
if ($filesToAnalyze !== []) {
if ($toFix) {
$commandName .= ':fix';
}
echo 'Files to analyse:' . PHP_EOL . implode(
PHP_EOL,
array_map(fn ($f): string => '- ' . $f, $filesToAnalyze)
) . PHP_EOL;
$escapedFiles = array_map(fn ($file): string => escapeshellarg($file), $filesToAnalyze);
$escapedFilesRaw = implode(' ', $escapedFiles);
$command = 'composer ' . escapeshellarg($commandName) . ' -- --format=txt --show-progress=none ' . $escapedFilesRaw;
passthru($command, $exitCode);
echo $exitCode === 0 ? '✔️ No errors!' . PHP_EOL : '❌ Errors found!' . PHP_EOL;
return $exitCode;
}
echo 'No files to analyse!' . PHP_EOL;
return 0;
}
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/php-cs-fixer/config/base.strict.php | php-tools/php-cs-fixer/config/base.strict.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
use PhpCsFixer\Config;
use Tools\PhpCsFixer\PhpCsFixerRuleSet;
return (new Config())
// @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/7777
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setRules(PhpCsFixerRuleSet::getRules());
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/php-cs-fixer/config/base.unstrict.php | php-tools/php-cs-fixer/config/base.unstrict.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
use PhpCsFixer\Config;
use Tools\PhpCsFixer\PhpCsFixerRuleSet;
return (new Config())
// @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/pull/7777
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRiskyAllowed(false)
->setRules(PhpCsFixerRuleSet::getRulesSafe());
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/rector/src/Command/RunRectorOnDiffCommandHandler.php | php-tools/rector/src/Command/RunRectorOnDiffCommandHandler.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
namespace Tools\Rector\Command;
final class RunRectorOnDiffCommandHandler
{
public function run(RunRectorOnDiffCommand $command): void
{
$args = $command->args;
$toFix = true;
if (in_array('--dry-run', $args, true)) {
$toFix = false;
}
echo '################################################' . PHP_EOL;
echo '=> Preparing files to analyse' . PHP_EOL;
$diffFiles = [];
foreach ($args as $key => $arg) {
if (str_starts_with($arg, $command->moduleName . '/') && str_ends_with($arg, '.php')) {
$replacement = preg_replace('/^' . preg_quote($command->moduleName . '/', '/') . '/', '', $arg);
if ($replacement === null) {
echo '⚠️ Error processing file when removing module name: ' . $arg . PHP_EOL;
exit(1);
}
$diffFiles[] = $replacement;
}
if (str_starts_with($arg, $command->moduleName . '/')) {
unset($args[$key]);
}
}
if ($diffFiles === []) {
echo 'No files to analyse!' . PHP_EOL;
exit(0);
}
$pathsToAnalyze = [];
foreach ($command->sections as $section) {
$pathsToAnalyze[$section] = [];
}
foreach ($diffFiles as $file) {
$matched = false;
foreach (array_keys($pathsToAnalyze) as $section) {
if ($this->matchesConfig($file, $command->pathsConfig[$section])) {
$pathsToAnalyze[$section][] = $file;
$matched = true;
break;
}
}
if (! $matched) {
echo '⚠️ File not recognised: ' . $file . PHP_EOL;
}
}
$hasErrors = false;
foreach ($pathsToAnalyze as $section => $files) {
$exitCode = $this->executeRector("rector:{$section}", $files, $toFix);
if (! $hasErrors && $exitCode !== 0) {
$hasErrors = true;
}
}
($hasErrors) ? exit(1) : exit(0);
}
/**
* @param array{paths: array<int, string>, skip: array<int, string>} $config
*/
private function matchesConfig(string $file, array $config): bool
{
return array_filter(
$config['paths'],
fn ($path): bool => str_starts_with($file, $path)
) !== []
&& array_filter(
$config['skip'],
fn ($skip): bool => str_starts_with($file, $skip)
) === [];
}
/**
* @param array<int,string> $filesToAnalyze
*/
private function executeRector(string $commandName, array $filesToAnalyze, bool $toFix): int
{
echo '################################################' . PHP_EOL;
echo '=> Running ' . $commandName . PHP_EOL;
if ($filesToAnalyze !== []) {
if ($toFix) {
$commandName .= ':fix';
}
echo 'Files to analyse:' . PHP_EOL . implode(
PHP_EOL,
array_map(fn ($file): string => '- ' . $file, $filesToAnalyze)
) . PHP_EOL;
$escapedFiles = array_map(fn ($file): string => escapeshellarg($file), $filesToAnalyze);
$escapedFilesRaw = implode(' ', $escapedFiles);
$command = 'composer ' . escapeshellarg($commandName) . ' -- --no-progress-bar ' . $escapedFilesRaw;
passthru($command, $exitCode);
echo $exitCode === 0 ? '✔️ No errors!' . PHP_EOL : '❌ Errors found!' . PHP_EOL;
return $exitCode;
}
echo 'No files to analyse!' . PHP_EOL;
return 0;
}
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/rector/src/Command/RunRectorOnDiffCommand.php | php-tools/rector/src/Command/RunRectorOnDiffCommand.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
namespace Tools\Rector\Command;
use Webmozart\Assert\Assert;
use Webmozart\Assert\InvalidArgumentException;
final readonly class RunRectorOnDiffCommand
{
/**
* @param array<string> $sections
* @param array<string, array{paths: array<int, string>, skip: array<int, string>}> $pathsConfig
* @param array<int, string> $args
*
* @throws InvalidArgumentException
*/
public function __construct(
public string $moduleName,
public array $sections,
public array $pathsConfig,
public array $args,
) {
Assert::notEmpty($moduleName, 'Module name must be provided');
Assert::notEmpty($sections, 'At least one section must be provided');
Assert::notEmpty($pathsConfig, 'Paths configuration must be provided');
Assert::notEmpty($args, 'Arguments must be provided');
Assert::allString($sections, 'Sections must be strings');
Assert::allString($args, 'Arguments must be strings');
Assert::allInArray($sections, array_keys($pathsConfig), 'One or more sections are not present in paths configuration');
foreach ($pathsConfig as $config) {
Assert::keyExists($config, 'paths', 'Each config must have the "paths" key');
Assert::keyExists($config, 'skip', 'Each config must have the "skip" key');
}
}
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/rector/config/centreon.bootstrap.php | php-tools/rector/config/centreon.bootstrap.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
if (! defined('_CENTREON_PATH_')) {
define('_CENTREON_PATH_', __DIR__ . '/../../../centreon/');
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/rector/config/base.strict.php | php-tools/rector/config/base.strict.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\Config\RectorConfig;
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
return RectorConfig::configure()
->withParallel()
->withBootstrapFiles([
__DIR__ . '/centreon.bootstrap.php',
])
->withPhpSets()
->withComposerBased(doctrine: true, phpunit: true, symfony: true)
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
typeDeclarations: true,
earlyReturn: true,
doctrineCodeQuality: true,
symfonyCodeQuality: true,
)
->withSkip([
RenameClassConstFetchRector::class,
CatchExceptionNameMatchingTypeRector::class,
DisallowedEmptyRuleFixerRector::class,
EncapsedStringsToSprintfRector::class,
NewlineAfterStatementRector::class, // conflict with PHP CS Fixer rules
]);
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/rector/config/rules.unstrict.php | php-tools/rector/config/rules.unstrict.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\CodeQuality\Rector\ClassMethod\InlineArrayReturnAssignRector;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
use Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector;
use Rector\CodeQuality\Rector\Foreach_\ForeachToInArrayRector;
use Rector\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector;
use Rector\CodeQuality\Rector\If_\ShortenElseIfRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
use Rector\CodeQuality\Rector\Ternary\ArrayKeyExistsTernaryThenValueToCoalescingRector;
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
use Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector;
use Rector\CodingStyle\Rector\ClassConst\SplitGroupedClassConstantsRector;
use Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\Property\SplitGroupedPropertiesRector;
use Rector\CodingStyle\Rector\Ternary\TernaryConditionVariableAssignmentRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPublicMethodParameterRector;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
use Rector\Php52\Rector\Property\VarToPublicPropertyRector;
use Rector\Php52\Rector\Switch_\ContinueToBreakInSwitchRector;
use Rector\Php53\Rector\FuncCall\DirNameFileConstantToDirConstantRector;
use Rector\Php53\Rector\Ternary\TernaryToElvisRector;
use Rector\Php53\Rector\Variable\ReplaceHttpServerVarsByServerRector;
use Rector\Php54\Rector\Array_\LongArrayToShortArrayRector;
use Rector\Php54\Rector\Break_\RemoveZeroBreakContinueRector;
use Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector;
use Rector\Php55\Rector\ClassConstFetch\StaticToSelfOnFinalClassRector;
use Rector\Php55\Rector\FuncCall\GetCalledClassToSelfClassRector;
use Rector\Php55\Rector\FuncCall\GetCalledClassToStaticClassRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php70\Rector\ClassMethod\Php4ConstructorRector;
use Rector\Php70\Rector\FuncCall\CallUserMethodRector;
use Rector\Php70\Rector\FuncCall\EregToPregMatchRector;
use Rector\Php70\Rector\FuncCall\MultiDirnameRector;
use Rector\Php70\Rector\FuncCall\RenameMktimeWithoutArgsToTimeRector;
use Rector\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector;
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector;
use Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector;
use Rector\Php71\Rector\Assign\AssignArrayToStringRector;
use Rector\Php71\Rector\BooleanOr\IsIterableRector;
use Rector\Php71\Rector\List_\ListToArrayDestructRector;
use Rector\Php71\Rector\TryCatch\MultiExceptionCatchRector;
use Rector\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector;
use Rector\Php72\Rector\FuncCall\GetClassOnNullRector;
use Rector\Php72\Rector\FuncCall\ParseStrWithResultArgumentRector;
use Rector\Php72\Rector\FuncCall\StringifyDefineRector;
use Rector\Php72\Rector\Unset_\UnsetCastRector;
use Rector\Php72\Rector\While_\WhileEachToForeachRector;
use Rector\Php73\Rector\BooleanOr\IsCountableRector;
use Rector\Php73\Rector\FuncCall\ArrayKeyFirstLastRector;
use Rector\Php73\Rector\FuncCall\SetCookieRector;
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
use Rector\Php74\Rector\ArrayDimFetch\CurlyToSquareBracketArrayStringRector;
use Rector\Php74\Rector\Assign\NullCoalescingOperatorRector;
use Rector\Php74\Rector\Double\RealToFloatTypeCastRector;
use Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector;
use Rector\Php74\Rector\FuncCall\FilterVarToAddSlashesRector;
use Rector\Php74\Rector\FuncCall\MbStrrposEncodingArgumentPositionRector;
use Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector;
use Rector\Php74\Rector\StaticCall\ExportToReflectionFunctionRector;
use Rector\Php74\Rector\Ternary\ParenthesizeNestedTernaryRector;
use Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector;
use Rector\Php80\Rector\ClassMethod\AddParamBasedOnParentClassMethodRector;
use Rector\Php80\Rector\ClassMethod\FinalPrivateToPrivateVisibilityRector;
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
use Rector\Php80\Rector\Identical\StrEndsWithRector;
use Rector\Php80\Rector\Identical\StrStartsWithRector;
use Rector\Php80\Rector\NotIdentical\StrContainsRector;
use Rector\Php80\Rector\Property\NestedAnnotationToAttributeRector;
use Rector\Php82\Rector\Encapsed\VariableInStringInterpolationFixerRector;
use Rector\Php82\Rector\FuncCall\Utf8DecodeEncodeToMbConvertEncodingRector;
use Rector\Transform\Rector\Attribute\AttributeKeyToClassConstFetchRector;
use Rector\Transform\Rector\FuncCall\FuncCallToConstFetchRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector;
use Rector\TypeDeclaration\Rector\FunctionLike\AddParamTypeSplFixedArrayRector;
use Rector\Visibility\Rector\ClassMethod\ExplicitPublicClassMethodRector;
return [
// ******************* performance (done) *******************
// OK 70 files / Change count array comparison to empty array comparison to improve performance
CountArrayToEmptyArrayComparisonRector::class,
// OK 27 files / Change count() in for function to own variable
ForRepeatedCountToOwnVariableRector::class,
// ******************* coding quality (done) *******************
// OK / Add missing dynamic properties
CompleteDynamicPropertiesRector::class,
// OK 215 files / Add return type void to function like without any return
AddVoidReturnTypeWhereNoReturnRector::class,
// OK 114 files / Add closure return type void if there is no return
AddClosureVoidReturnTypeWhereNoReturnRector::class,
// KO 0 files / Add exact fixed array type in known cases
AddParamTypeSplFixedArrayRector::class,
// KO 0 files / Changed nested annotations to attributes
NestedAnnotationToAttributeRector::class,
// KO 0 files / Replace key value on specific attribute to class constant
AttributeKeyToClassConstFetchRector::class,
// OK 1 file / Change property modifier from var to public
VarToPublicPropertyRector::class,
// KO class rules not exists / Remove unused parameter in public method on final class without extends and interface
RemoveUnusedPublicMethodParameterRector::class,
// OK 1 file / Simplify is_array and empty functions combination into a simple identical check for an empty array
SimplifyEmptyArrayCheckRector::class,
// OK 131 files / Simplify empty() functions calls on empty arrays
SimplifyEmptyCheckOnEmptyArrayRector::class,
// OK 1 file // Change array_key_exists() ternary to coalescing
ArrayKeyExistsTernaryThenValueToCoalescingRector::class,
// OK 5 files / Inline just in time array dim fetch assigns to direct return
InlineArrayReturnAssignRector::class,
// OK 48 files / Move property default from constructor to property default
InlineConstructorDefaultToPropertyRector::class,
// Simplify foreach loops into in_array when possible
ForeachToInArrayRector::class,
// OK 154 files / Changes if/else for same value as assign to ternary
SimplifyIfElseToTernaryRector::class,
// OK 47 files / Shortens else/if to elseif
ShortenElseIfRector::class,
// KO / Complete missing if/else brackets
CompleteMissingIfElseBracketRector::class,
// ******************* coding style (done) *******************
// OK 1 file / Add explicit public method visibility
ExplicitPublicClassMethodRector::class,
// KO 0 files / Changes use of function calls to use constants
FuncCallToConstFetchRector::class,
// KO 0 files / Remove final from constants in classes defined as final
RemoveFinalFromConstRector::class,
// KO 0 files / Separate grouped properties to own lines
SplitGroupedPropertiesRector::class,
// OK 63 files / Separate class constant to own lines
SplitGroupedClassConstantsRector::class,
// OK 34 files / Split multiple inline assigns to each own lines default value, to prevent undefined array issues
SplitDoubleAssignRector::class,
// OK 102 files / Assign outcome of ternary condition to variable, where applicable
TernaryConditionVariableAssignmentRector::class,
// ******************* PHP *******************
// --------------------to do to migrate(done)--------------
// OK 78 files / Convert dirname(__FILE__) to __DIR__ (5.3)
DirNameFileConstantToDirConstantRector::class,
// KO 0 files / Rename old $HTTP_* variable names to new replacements (5.3)
ReplaceHttpServerVarsByServerRector::class,
// OK 20 files / Use ?: instead of ?, where useful (5.3)
TernaryToElvisRector::class,
// KO 0 files / Remove 0 from break and continue (5.4)
RemoveZeroBreakContinueRector::class,
// OK 612 files / Long array to short array (5.4)
LongArrayToShortArrayRector::class,
// KO 0 files Change get_called_class() to self::class on final class (5.5)
GetCalledClassToSelfClassRector::class,
// OK 6 files / Change get_called_class() to static::class on non-final class (5.5)
GetCalledClassToStaticClassRector::class,
// KO 0 files / Change static::class to self::class on final class (5.5)
StaticToSelfOnFinalClassRector::class,
// KO 0 files / Replace string class names by ::class constant (5.5)
StringClassNameToClassConstantRector::class,
// 3 files / Change __CLASS__ to self::class (5.5)
ClassConstantToSelfClassRector::class,
// OK 2 files / Changes $this->call() to static method to static call (7.0)
ThisCallOnStaticMethodToStaticCallRector::class,
// KO 0 files / Changes ereg*() to preg*() calls (7.0)
EregToPregMatchRector::class,
// KO 0 files / Changes call_user_method()/call_user_method_array() to call_user_func()/call_user_func_array() (7.0)
CallUserMethodRector::class,
// KO 0 files / Renames mktime() without arguments to time() (7.0)
RenameMktimeWithoutArgsToTimeRector::class,
// KO 0 files / Changes multiple dirname() calls to one with nesting level (7.0)
MultiDirnameRector::class,
// OK 1 files / Changes static call to instance call, where not useful (7.0)
StaticCallOnNonStaticToInstanceCallRector::class,
// OK 23 files / Change if with isset and return to coalesce (7.0)
IfIssetToCoalescingRector::class,
// OK 120 files / Changes unneeded null check to ?? operator (7.0)
TernaryToNullCoalescingRector::class,
// KO 0 files / Changes PHP 4 style constructor to __construct (7.0)
Php4ConstructorRector::class,
// KO 0 files / String cannot be turned into array by assignment anymore (7.1)
AssignArrayToStringRector::class,
// OK 4 files / Changes multi catch of same exception to single one | separated. (7.1)
MultiExceptionCatchRector::class,
// KO 0 files / Changes is_array + Traversable check to is_iterable (7.1)
IsIterableRector::class,
// OK 41 files / Change list() to array destruct (7.1)
ListToArrayDestructRector::class,
// KO 0 files / each() function is deprecated, use foreach() instead. (7.2)
WhileEachToForeachRector::class,
// KO 0 files / Make first argument of define() string (7.2)
StringifyDefineRector::class,
// Use $result argument in parse_str() function (7.2)
ParseStrWithResultArgumentRector::class,
// KO 0 files / Use anonymous functions instead of deprecated create_function() (7.2)
CreateFunctionToAnonymousFunctionRector::class,
// KO 0 files / Null is no more allowed in get_class() (7.2)
GetClassOnNullRector::class,
// KO 0 files / Removes (unset) cast (7.2)
UnsetCastRector::class,
// Makes needles explicit strings (7.3)
StringifyStrNeedlesRector::class,
// Convert setcookie argument to PHP7.3 option array (7.3)
SetCookieRector::class,
// Make use of array_key_first() and array_key_last() (7.3)
ArrayKeyFirstLastRector::class,
// Changes is_array + Countable check to is_countable (7.3)
IsCountableRector::class,
// Use break instead of continue in switch statements (7.3)
ContinueToBreakInSwitchRector::class,
// KO 0 files / Change filter_var() with slash escaping to addslashes() (7.4)
FilterVarToAddSlashesRector::class,
// KO 0 files / Change mb_strrpos() encoding argument position (7.4)
MbStrrposEncodingArgumentPositionRector::class,
// KO 0 files / Change array_key_exists() on property to property_exists() (7.4)
ArrayKeyExistsOnPropertyRector::class,
// KO 0 files / Change deprecated (real) to (float) (7.4)
RealToFloatTypeCastRector::class,
// KO 0 files / Change export() to ReflectionFunction alternatives (7.4)
ExportToReflectionFunctionRector::class,
// KO 26 files / Add null default to properties with PHP 7.4 property nullable type(7.4)
RestoreDefaultNullToNullableTypePropertyRector::class,
// OK 17 files / Use null coalescing operator ??= (7.4)
NullCoalescingOperatorRector::class,
// KO 0 files / Add parentheses to nested ternary (7.4)
ParenthesizeNestedTernaryRector::class,
// KO 0 files / Change curly based array and string to square bracket (7.4)
CurlyToSquareBracketArrayStringRector::class,
// OK 1 file Changes various implode forms to consistent one (8.0)
ConsistentImplodeRector::class,
// KO 1 file but not correct / Remove unused parent call with no parent class (8.0)
RemoveParentCallWithoutParentRector::class,
// OK 6 files / Change get_class($object) to faster $object::class (8.0)
ClassOnObjectRector::class,
// OK 0 files / Change $this::class to static::class or self::class depends on class modifier (8.0)
ClassOnThisVariableObjectRector::class,
// OK 12 files / Change helper functions to str_ends_with() (8.0)
StrEndsWithRector::class,
// OK 15 files / Change helper functions to str_starts_with() (8.0)
StrStartsWithRector::class,
// OK 33 files / Replace strpos() !== false and strstr() with str_contains() (8.0)
StrContainsRector::class,
// KO 0 file / Changes method visibility from final private to only private (8.0)
FinalPrivateToPrivateVisibilityRector::class,
// KO 0 files / Add missing parameter based on parent class method (8.0)
AddParamBasedOnParentClassMethodRector::class,
// OK 7 files / Change deprecated utf8_decode and utf8_encode to mb_convert_encoding (8.2)
Utf8DecodeEncodeToMbConvertEncodingRector::class,
// OK 0 files / Replace deprecated "${var}" to "{$var}" (8.2)
VariableInStringInterpolationFixerRector::class,
];
// ================================= RULES TO DISCUSS OR NOT DONE =================================
// // --------------- to do later (not done) -----------------
// ClosureToArrowFunctionRector::class, // OK 111 files / Change closure to arrow function (7.4)
// ChangeSwitchToMatchRector::class, // Change switch() to match() (8.0)
// StringableForToStringRector::class, // Add Stringable interface to classes with __toString() method (8.0)
// StringableForToStringRector::class, // Add Stringable interface to classes with __toString() method (8.0)
// ClassPropertyAssignToConstructorPromotionRector::class, // Change simple property init and assign to constructor promotion (8.0)
// MyCLabsMethodCallToEnumConstRector::class, // Refactor MyCLabs enum fetch to Enum const (8.1)
// SpatieEnumMethodCallToEnumConstRector::class, // Refactor Spatie enum method calls (8.1)
// NullToStrictStringFuncCallArgRector::class, // Change null to strict string defined function call args (8.1)
// NullToStrictStringFuncCallArgRector::class, // Change null to strict string defined function call args (8.1)
// // ******************* NOT TO USE *******************
// TernaryFalseExpressionToIfRector::class, // OK 26 files /Change ternary with false to if and explicit call
// RemoveExtraParametersRector::class, // OK 48 files / Remove extra parameters (7.1)
// // ******************* TO DISCUSS (not done) *******************
// // ---------------- PHP not sure ----------------
// SensitiveHereNowDocRector::class, Changes heredoc/nowdoc that contains closing word to safe wrapper name (7.3)
// SensitiveConstantNameRector::class, Changes case insensitive constants to sensitive ones.(7.3)
// ReadOnlyPropertyRector::class, // Decorate read-only property with readonly attribute (8.1)
// NewInInitializerRector::class, // Replace property declaration of new state with direct new (8.1)
// ReadOnlyClassRector::class, // Decorate read-only class with readonly attribute (8.1)
// BoolReturnTypeFromBooleanConstReturnsRector::class, // Add return bool, based on direct true/false returns
// RemoveAlwaysElseRector::class, // Split if statement, when if condition always break execution flow
// RenameVariableToMatchNewTypeRector::class, // Rename variable to match new ClassType
// RenameParamToMatchTypeRector::class, // Rename param to match ClassType
// RenamePropertyToMatchTypeRector::class, // Rename property and method param to match its type
// RenameVariableToMatchMethodCallReturnTypeRector::class, // Rename variable to match method return type
// ExceptionHandlerTypehintRector::class, // Change typehint from Exception to Throwable. (7.0)
// // ---------------- strange ----------------
// NullableCompareToNullRector::class, // Changes negate of empty comparison of nullable value to explicit === or !== compare
// - if ($user = $this->security->getUser()) {
// + if (($user = $this->security->getUser()) !== null) {
// MakeInheritedMethodVisibilitySameAsParentRector::class, // Make method visibility same as parent one ==> only for test classes
// // ---------------- deprecated ?? ----------------
// WrapEncapsedVariableInCurlyBracesRector::class, // 152 files Wrap encapsed variables in curly braces
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/rector/config/base.unstrict.php | php-tools/rector/config/base.unstrict.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
use Rector\Config\RectorConfig;
/** @var array<class-string<Rector\Contract\Rector\RectorInterface>> $rectorRules */
$rectorRules = require_once __DIR__ . '/rules.unstrict.php';
return RectorConfig::configure()
->withParallel()
->withRules($rectorRules)
->withBootstrapFiles([
__DIR__ . '/centreon.bootstrap.php',
]);
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/phpstan/src/AbsolutePathErrorFormatter.php | php-tools/phpstan/src/AbsolutePathErrorFormatter.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
namespace Tools\PhpStan;
use PHPStan\Analyser\Error;
use PHPStan\Command\AnalysisResult;
use PHPStan\Command\ErrorFormatter\ErrorFormatter;
use PHPStan\Command\Output;
/**
* This class is used to set a custom formatter to phpstan exporting absolute paths.
*/
class AbsolutePathErrorFormatter implements ErrorFormatter
{
/**
* Format errors output.
*
* @param AnalysisResult $analysisResult Result of check style
* @param Output $output Output stream to write
*
* @return int If there are some errors
*/
public function formatErrors(
AnalysisResult $analysisResult,
Output $output,
): int {
$output->writeRaw('<?xml version="1.0" encoding="UTF-8"?>');
$output->writeLineFormatted('');
$output->writeRaw('<checkstyle>');
$output->writeLineFormatted('');
foreach ($this->groupByFile($analysisResult) as $filePath => $errors) {
$filePath = $this->parseFilePath($filePath);
$output->writeRaw(
sprintf(
'<file name="%s">',
$filePath
)
);
$output->writeLineFormatted('');
foreach ($errors as $error) {
$output->writeRaw(
sprintf(
' <error line="%d" column="1" severity="error" message="%s" source="PHPStan" />',
$this->escape((string) $error->getLine()),
$this->escape((string) $error->getMessage())
)
);
$output->writeLineFormatted('');
}
$output->writeRaw('</file>');
$output->writeLineFormatted('');
}
$notFileSpecificErrors = $analysisResult->getNotFileSpecificErrors();
if ($notFileSpecificErrors !== []) {
$output->writeRaw('<file>');
$output->writeLineFormatted('');
foreach ($notFileSpecificErrors as $error) {
$output->writeRaw(
sprintf(' <error severity="error" message="%s" source="PHPStan" />', $this->escape($error))
);
$output->writeLineFormatted('');
}
$output->writeRaw('</file>');
$output->writeLineFormatted('');
}
if ($analysisResult->hasWarnings()) {
$output->writeRaw('<file>');
$output->writeLineFormatted('');
foreach ($analysisResult->getWarnings() as $warning) {
$output->writeRaw(
sprintf(' <error severity="warning" message="%s" source="PHPStan" />', $this->escape($warning))
);
$output->writeLineFormatted('');
}
$output->writeRaw('</file>');
$output->writeLineFormatted('');
}
$output->writeRaw('</checkstyle>');
$output->writeLineFormatted('');
return $analysisResult->hasErrors() ? 1 : 0;
}
/**
* Escapes values for using in XML.
*/
protected function escape(string $string): string
{
return htmlspecialchars($string, ENT_XML1 | ENT_COMPAT, 'UTF-8');
}
/**
* Group errors by file.
*
* @return array<string, array<Error>> array that have as key the absolute path of file
* and as value an array with occurred errors
*/
private function groupByFile(AnalysisResult $analysisResult): array
{
$files = [];
/** @var Error $fileSpecificError */
foreach ($analysisResult->getFileSpecificErrors() as $fileSpecificError) {
$files[$fileSpecificError->getFile()][] = $fileSpecificError;
}
return $files;
}
/**
* Remove useless information like trait context.
*
* @param string $filePath Absolute file path
*
* @return string File path with removed useless information
*/
private function parseFilePath(string $filePath): string
{
if (preg_match('/(.+)\s+\(in context/', $filePath, $matches)) {
$filePath = $matches[1];
}
return $this->escape($filePath);
}
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
centreon/centreon | https://github.com/centreon/centreon/blob/6ae83001e94de0a4cec11e084780fcfa63f1c985/php-tools/phpstan/src/CustomRules/CentreonRuleErrorBuilder.php | php-tools/phpstan/src/CustomRules/CentreonRuleErrorBuilder.php | <?php
/*
* Copyright 2005 - 2025 Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information : contact@centreon.com
*
*/
declare(strict_types=1);
namespace Tools\PhpStan\CustomRules;
use PHPStan\Rules\RuleError;
use PHPStan\Rules\RuleErrorBuilder;
/**
* This class defines a method to build a custom error message for PHPStan custom rules by
* overloading its parent's method message().
*/
class CentreonRuleErrorBuilder
{
/**
* This method builds a custom error message for PHPStan custom rules by overloading its
* parent's method message.
*
* @return RuleErrorBuilder<RuleError>
*/
public static function message(string $message): RuleErrorBuilder
{
return RuleErrorBuilder::message("[CENTREON-RULE]: {$message}");
}
}
| php | Apache-2.0 | 6ae83001e94de0a4cec11e084780fcfa63f1c985 | 2026-01-05T04:45:18.914281Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.