src/Chatkit.php
public function createRoom($options)
    {
        if (!isset($options['creator_id'])) {
            throw new MissingArgumentException('You must provide the ID of the user creating the room');
        }
        if (!isset($options['name'])) {
            throw new MissingArgumentException('You must provide a name for the room');
        }

        $body = [
            'name' => $options['name'],
            'private' => false
        ];
        if (isset($options['private'])) {
            $body['private'] = $options['private'];
        }
        if (isset($options['user_ids'])) {
            $body['user_ids'] = $options['user_ids'];
        }
        if (isset($options['custom_data'])) {
        	$body['custom_data'] = $options['custom_data'];
        }

        $token = $this->getServerToken([ 'user_id' => $options['creator_id'] ])['token'];

        return $this->apiRequest([
            'method' => 'POST',
            'path' => '/rooms',
            'jwt' => $token,
            'body' => $body
        ]);
    }
public function createRoom($options)
    {
        if (!isset($options['creator_id'])) {
            throw new MissingArgumentException('You must provide the ID of the user creating the room');
        }
        if (!isset($options['name'])) {
            throw new MissingArgumentException('You must provide a name for the room');
        }

        $body = [
            'name' => $options['name'],
            'private' => false
        ];
        if (isset($options['private'])) {
            $body['private'] = $options['private'];
        }
        if (isset($options['user_ids'])) {
            $body['user_ids'] = $options['user_ids'];
        }
        if (isset($options['custom_data'])) {
        	$body['custom_data'] = $options['custom_data'];
        }

        $token = $this->getServerToken([ 'user_id' => $options['creator_id'] ])['token'];

        return $this->apiRequest([
            'method' => 'POST',
            'path' => '/rooms',
            'jwt' => $token,
            'body' => $body
        ]);
    }
public function createRoom ( $ options ) { if ( ! isset ( $ options [ 'creator_id' ] ) ) { throw new MissingArgumentException ( 'You must provide the ID of the user creating the room' ) ; } if ( ! isset ( $ options [ 'name' ] ) ) { throw new MissingArgumentException ( 'You must provide a name for the room' ) ; } $ body = [ 'name' => $ options [ 'name' ] , 'private' => false ] ; if ( isset ( $ options [ 'private' ] ) ) { $ body [ 'private' ] = $ options [ 'private' ] ; } if ( isset ( $ options [ 'user_ids' ] ) ) { $ body [ 'user_ids' ] = $ options [ 'user_ids' ] ; } if ( isset ( $ options [ 'custom_data' ] ) ) { $ body [ 'custom_data' ] = $ options [ 'custom_data' ] ; } $ token = $ this -> getServerToken ( [ 'user_id' => $ options [ 'creator_id' ] ] ) [ 'token' ] ; return $ this -> apiRequest ( [ 'method' => 'POST' , 'path' => '/rooms' , 'jwt' => $ token , 'body' => $ body ] ) ; }
Creates a new room.

@param array $options  The room options
[Available Options]
• creator_id (string|required): Represents the ID of the user that you want to create the room.
• name (string|optional): Represents the name with which the room is identified.
A room name must not be longer than 40 characters and can only contain lowercase letters,
numbers, underscores and hyphens.
• private (boolean|optional): Indicates if a room should be private or public. Private by default.
• user_ids (array|optional): If you wish to add users to the room at the point of creation,
you may provide their user IDs.
. custom_data (assoc array|optional): If you wish to attach some custom data to a room,
you may provide a list of key value pairs.
@return array
Creates a new room .