PHP code example of sdksio / apimatic-verizon-sdk
1. Go to this page and download the library: Download sdksio/apimatic-verizon-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/ */
sdksio / apimatic-verizon-sdk example snippets
use VerizonLib\Logging\LoggingConfigurationBuilder;
use VerizonLib\Logging\RequestLoggingConfigurationBuilder;
use VerizonLib\Logging\ResponseLoggingConfigurationBuilder;
use Psr\Log\LogLevel;
use VerizonLib\Environment;
use VerizonLib\Authentication\ThingspaceOauthCredentialsBuilder;
use VerizonLib\Models\OauthScopeThingspaceOauth;
use VerizonLib\Authentication\VzM2MTokenCredentialsBuilder;
use VerizonLib\Authentication\SessionTokenCredentialsBuilder;
use VerizonLib\Authentication\ThingspaceOauth1CredentialsBuilder;
use VerizonLib\VerizonClientBuilder;
$client = VerizonClientBuilder::init()
->thingspaceOauthCredentials(
ThingspaceOauthCredentialsBuilder::init(
'OAuthClientId',
'OAuthClientSecret'
)
->oauthScopes(
[
OauthScopeThingspaceOauth::DISCOVERYREAD,
OauthScopeThingspaceOauth::SERVICEPROFILEREAD
]
)
)
->vzM2MTokenCredentials(
VzM2MTokenCredentialsBuilder::init(
'VZ-M2M-Token'
)
)
->sessionTokenCredentials(
SessionTokenCredentialsBuilder::init(
'SessionToken'
)
)
->thingspaceOauth1Credentials(
ThingspaceOauth1CredentialsBuilder::init(
'OAuthClientId',
'OAuthClientSecret'
)
)
->environment(Environment::PRODUCTION)
->loggingConfiguration(
LoggingConfigurationBuilder::init()
->level(LogLevel::INFO)
->requestConfiguration(RequestLoggingConfigurationBuilder::init()->body(true))
->responseConfiguration(ResponseLoggingConfigurationBuilder::init()->headers(true))
)
->build();