PHP code example of wavelabs / php-client-api

1. Go to this page and download the library: Download wavelabs/php-client-api 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/ */

    

wavelabs / php-client-api example snippets


   curl -sS https://getcomposer.org/installer | php
 

 php composer.phar install
 

 inclide 'vendor/autoload.php';
 

  

 // Include autoloader
 vice
 $response = $auth->signup([
     "username" => "demouser",
     "password" => "demopass",
     "email" => "[email protected]",
     "firstName" => "first name",
     "lastName" => "last name"
 ]);
 // get service HTTP status code
 $http_code = $auth->getLastHttpCode();
 
 // if HTTP status is OK
 if($http_code == 200){
     // message from server
     echo "Token :".$response->token->access_token;
     echo "Member ID :".$response->member->id;
     echo "Email :".$response->member->email;
     echo "First Name :".$response->member->firstName;
 }else {
     //get Errors
     print_r(\Wavelabs\core\ApiBase::getErrors());
 }
 

 // Include autoloader
 \core\Auth();
 
 // calling login service
 $response = $auth->login("sastrylal", "Admin@123");
 // get service HTTP status code
 $http_code = $auth->getLastHttpCode();
 
 // if HTTP status is OK
 if($http_code == 200){
     echo "Welcome to ". $response->member->firstName;
 }else {
     //get Errors 
     print_r(\Wavelabs\core\ApiBase::getErrors());
 }
 
json
 ""wavelabs/php-client-api": "*"
 }