PHP code example of nullform / app-store-server-api-client
1. Go to this page and download the library: Download nullform/app-store-server-api-client 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/ */
nullform / app-store-server-api-client example snippets
// As instance of anonymous class...
$apiKey = new class extends AbstractApiKey {};
$apiKey->setPrivateKey(\file_get_contents($privateKeyFile));
$apiKey->setPrivateKeyId('Your private key id');
$apiKey->setIssuerId('Your issuer id');
$apiKey->setName('Key name (optional)');
// ... or as instance of ApiKey
$apiKey = new ApiKey(
\file_get_contents($privateKeyFile),
'Your private key id',
'Your issuer id',
'Key name (optional)'
);
// As instance of anonymous class...
$bundle = new class extends AbstractBundle {};
$bundle->setBundleId('Your bundle id');
$bundle->setName('Bundle name (optional)');
// ... or as instance of Bundle
$bundle2 = new Bundle('Your bundle #2 id');
$client = new AppStoreServerApiClient($apiKey, $bundle, Environment::PRODUCTION);
use Nullform\AppStoreServerApiClient\AppStoreServerApiClient;
use Nullform\AppStoreServerApiClient\AbstractModel;
use Nullform\AppStoreServerApiClient\Environment;
$apiKey = new MyApiKey(); // Extends AbstractApiKey
$bundle = new MyBundle(); // Extends AbstractBundle
$client = new AppStoreServerApiClient($apiKey, $bundle, Environment::SANDBOX);
$queryParams = new class extends AbstractModel {
public $param = 'value';
};
$requestBody = new class extends AbstractModel {
public $bodyParam = 'value';
};
// Get instance of ResponseInterface
$response = $client->callApi("POST", "inApps/v1/notifications/test", $queryParams, $requestBody);
// Get response body
$responseBody = $response->getBody()->getContents();