PHP code example of smartsupp / php-partner-client

1. Go to this page and download the library: Download smartsupp/php-partner-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

smartsupp / php-partner-client example snippets


$api = new Smartsupp\Auth\Api();

$response = $api->create(array(
  'email' => 'LOGIN_EMAIL',           //        // optional
  'lang' => 'en',                     // optional, lowercase; 2 characters
  'partnerKey' => 'PARTNER_API_KEY'   // optional
));

// print_r($response);  // success response
array(
  'account' => array(
    'key' => 'CHAT_KEY',
    'lang' => 'en'
  ),
  'user' => array(
    'email' => 'LOGIN_EMAIL',
    'name' => 'John Doe',
    'password' => 'YOUR_PASSWORD'
  )
);

// print_r($response); // failure response
array(
    'error' => 'EmailExists',
    'message' => 'Email already exists',
    'hint' => 'email'
);

$api = new Smartsupp\Auth\Api();

$response = $api->login(array(
  'email' => 'LOGIN_EMAIL',
  'password' => 'YOUR_PASSWORD'
));

// print_r($response);  // success response
array(
  'account' => array(
    'key' => 'CHAT_KEY',
    'lang' => 'en'
  )
);

// print_r($response); // failure response
array(
  'error' => 'InvalidCredential',
  'message' => 'Invalid password'
);