PHP code example of wrapit / php-sdk

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

    

wrapit / php-sdk example snippets


$wi = new \WrapIt\WrapIt([
    'domain' => '{domain}',
    'client_id' => '{client-id}',
    'client_secret' => '{client-secret}'
]);

// Use the LoginHelper to get an AccessToken

$userhelper = new \WrapIt\Helpers\WrapItUserHelper($wi, "{access-token}");

try {
    // Get data from the /people/me api
    $user = $userhelper->getUserData("me");
} catch (\WrapIt\Exceptions\WrapItResponseException $e) {
    echo 'The API returned an error: ' . $e->getMessage();
    exit;
}

echo 'Logged in as ' . $user["name"];