1. Go to this page and download the library: Download nps/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/ */
nps / php-sdk example snippets
use NpsSDK\Configuration;
use NpsSDK\Constants;
Configuration::environment(Constants::STAGING_ENV);
Configuration::secretKey(“yourSecretKeyHere”);
use NpsSDK\Configuration;
use NpsSDK\Constants;
Configuration::environment(Constants::STAGING_ENV);
Configuration::environment(Constants::SANDBOX_ENV);
Configuration::environment(Constants::PRODUCTION_ENV);
use NpsSDK\ApiException;
//Code
try{
//code or sdk call
}catch(ApiException $e){
//Code to handle error
}
use Monolog\Logger;
$logger = new Logger(“NpsSdk”);
use NpsSDK\Configuration;
Configuration::secretKey(“your key here”);
Configuration::logger($logger);
use NpsSDK\Configuration;
Configuration::secretKey(“your key here”);
Configuration::loglevel(“DEBUG”);
use NpsSDK\Configuration;
Configuration::secretKey(“your key here”);
Configuration::sanitize(true);
use NpsSDK\Configuration;
Configuration::secretKey(“your key here”);
Configuration::executionTimeout(60);
Configuration::connectionTimeout(10);
use NpsSDK\Configuration;
Configuration::secretKey(“your key here”);
Configuration::proxyUrl("http://yourproxy");
Configuration::proxyPort(6854);
Configuration::proxyUser("proxyUsername");
Configuration::proxyPass("proxyPassword");
use NpsSDK\Configuration;
Configuration::secretKey(“your key here”);
Configuration::useCache(True);
Configuration::cacheTTL(86400);
Configuration::cacheLocation("/tmp");
bash
$ composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.