2017 © Pedro Peláez
 

laravel tencent-cloudcomm

This is a Laravel package for server-end Tencent Cloud Communications API

image

imphinite/tencent-cloudcomm

This is a Laravel package for server-end Tencent Cloud Communications API

  • Thursday, February 8, 2018
  • by imphinite
  • Repository
  • 0 Watchers
  • 0 Stars
  • 529 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 39 % Grown

The README.md

Collection of Tencent Cloud Communication Web Services API Adapter for Laravel 5

Provides convenient way of setting up and making requests to Tencent Cloud Communication Web Services API from Laravel application., (*1)

For services documentation, APP key and Usage Limits visit: * Tencent Cloud Communication Services Documentation * Tencent Cloud Communication Services APP Key * Tencent Cloud Communication Services Price and Quota * Tencent Cloud Communication Services Usage Limit, (*2)

**SPECIAL THANKS TO Alexpechkarev. Part of web services engine is borrowed from Alexpechkarev/google-maps., (*3)

Features

  • Account Management
  • Send Message
  • Push Notifications
  • Group Management
  • Profile Picture Management
  • Chain Relationship Management
  • Chat Censor Management
  • Data Download
  • Online Status
  • Global Chat Restriction Management

Dependency

Installation

Issue following command in console:, (*4)

composer require imphinite/tencent-cloudcomm

Alternatively edit composer.json by adding following line and run composer update, (*5)

"require": { 
        ....,
        "imphinite/tencent-cloudcomm",

    },

Configuration

Register package service provider and facade in 'config/app.php', (*6)

'providers' => [
    ...
    CloudComm\ServiceProvider\CloudCommServiceProvider::class,
]

'aliases' => [
    ...
    'CloudComm' => CloudComm\Facades\CloudComm::class,
]

Publish configuration file using php artisan vendor:publish --tag=cloudcomm --force or simply copy package configuration file and paste into config/cloudcomm.php, (*7)

Open configuration file config/cloudcomm.php and 1. Add your app key 2. Add your appication admin identifier 3. Add your admin usersig (All of above are obtained from your App in Tencent Cloud Communication Services Console), (*8)

    /*
    |----------------------------------
    | SDK App ID
    |------------------------------------
    */

    'sdkappid'          => 'YOUR APP ID',
    ...,
    /*
    |----------------------------------
    | Identifier
    |------------------------------------
    */

    'identifier'          => 'YOUR APP ADMIN IDENTIFIER',
    ...,
    /*
    |----------------------------------
    | UserSig
    |------------------------------------
    */

    'usersig'           => 'YOUR ADMIN USERSIG',

If you like to use different admins for any of the services, you can overwrite master admin identifier and usersig by specifying them in the service array for selected web service., (*9)

Usage

Import this package at the top of your file:, (*10)

use CloudComm;
...

Here is an example of making request to Tencent-hosted Account Registration API:, (*11)

$service = CloudComm::load('register-account')
    ->setParam([
        'Identifier'            => 'testaccount1',
        'IdentifierType'        => 3,  // refer to Tencent documentation
        'Password'              => 'Testaccount1Password!'
    ]);
$response = $service->get();
...

Alternatively parameters can be set using setParamByKey() method. For deeply nested array use "dot" notation as per example below., (*12)

$service = CloudComm::load('register-account')
    ->setParamByKey('Identifier', 'testaccount1')
    ->setParamByKey('IdentifierType', 3)
    ->setParamByKey('Password', 'Testaccount1Password!');  //return $this
...

Another example showing request to Get User Status API:, (*13)

$service = CloudComm::load('get-user-status')
    ->setParam([
        'To_Account'            => [
            'testaccount1',
            'testaccount2'
        ]
    ]);
$response = $service->get();
...

Available methods


load( $serviceName ) - load web service by name, (*14)

Accepts string as parameter, web service name as specified in configuration file.
Returns reference to it's self., (*15)

CloudComm::load('nearbysearch') 
...

setParamByKey( $key, $value ) - set request parameter using key:value pair, (*16)

Accepts two parameters: * key - body parameter name * value - body parameter value, (*17)

Deeply nested array can use 'dot' notation to assign value.
Returns reference to it's self., (*18)

$service = CloudComm::load('register-account')
    ->setParamByKey('Identifier', 'testaccount1')
    ->setParamByKey('IdentifierType', 3)
    ->setParamByKey('Password', 'Testaccount1Password!');  //return $this
...

setParam( $parameters ) - set all request parameters at once, (*19)

Accepts array of parameters
Returns reference to it's self., (*20)

$service = CloudComm::load('register-account')
    ->setParam([
        'Identifier'            => 'testaccount1',
        'IdentifierType'        => 3,  // refer to Tencent documentation
        'Password'              => 'Testaccount1Password!'
    ]);
...

* get() - perform web service request (irrespectively to request type POST or GET ), (*21)

$response = CloudComm::load('register-account')
    ->setParam([
        'Identifier'            => 'testaccount1',
        'IdentifierType'        => 3,  // refer to Tencent documentation
        'Password'              => 'Testaccount1Password!'
    ])->get();

var_dump(json_decode($response));  // output 
...

MIT License

Collection of Tencent Cloud Communication Web Services API Adapter for Laravel 5 is released under the MIT License., (*22)

The Versions

08/02 2018

dev-master

9999999-dev

This is a Laravel package for server-end Tencent Cloud Communications API

  Sources   Download

MIT

The Requires

 

by Yan Lin Wang

tls tencent 云通信 腾讯云通信 tencent cloud tencent cloud communications tencent login service 腾讯帐号登陆集成

08/02 2018

1.0.0

1.0.0.0

This is a Laravel package for server-end Tencent Cloud Communications API

  Sources   Download

MIT

The Requires

 

by Yan Lin Wang

tls tencent 云通信 腾讯云通信 tencent cloud tencent cloud communications tencent login service 腾讯帐号登陆集成