PHP code example of shell / loyalty-sdk
1. Go to this page and download the library: Download shell/loyalty-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/ */
shell / loyalty-sdk example snippets
use LoyaltyApIsLib\Logging\LoggingConfigurationBuilder;
use LoyaltyApIsLib\Logging\RequestLoggingConfigurationBuilder;
use LoyaltyApIsLib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
use LoyaltyApIsLib\Environment;
use LoyaltyApIsLib\Authentication\PublicBearerTokenCredentialsBuilder;
use LoyaltyApIsLib\Authentication\PublicBasicTokenCredentialsBuilder;
use LoyaltyApIsLib\Authentication\PrivateBasicTokenCredentialsBuilder;
use LoyaltyApIsLib\Authentication\ClientAuthorizationTokenCredentialsBuilder;
use LoyaltyApIsLib\Authentication\CustomerHeaderCredentialsBuilder;
use LoyaltyApIsLib\LoyaltyApIsClientBuilder;
$client = LoyaltyApIsClientBuilder::init()
->publicBearerTokenCredentials(
PublicBearerTokenCredentialsBuilder::init(
'AccessToken'
)
)
->publicBasicTokenCredentials(
PublicBasicTokenCredentialsBuilder::init(
'Public Basic Token'
)
)
->privateBasicTokenCredentials(
PrivateBasicTokenCredentialsBuilder::init(
'Public Basic Token'
)
)
->clientAuthorizationTokenCredentials(
ClientAuthorizationTokenCredentialsBuilder::init(
'OAuthClientId',
'OAuthClientSecret'
)
)
->customerHeaderCredentials(
CustomerHeaderCredentialsBuilder::init(
'Authorization-Token'
)
)
->environment(Environment::SIT)
->loggingConfiguration(
LoggingConfigurationBuilder::init()
->level(LogLevel::INFO)
->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
)
->build();