1. Go to this page and download the library: Download weijiajia/apple-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/ */
weijiajia / apple-client example snippets
use Psr\Log\LoggerInterface;
use Psr\SimpleCache\CacheInterface;
use Weijiajia\AppleClient;
use Weijiajia\AppleClientFactory;
use Weijiajia\Cookies\Cookies;
use Weijiajia\Store\CacheStore;
$config = Config::fromArray([
'apple_auth' => [
'url' => 'https://your_apple_auth_url',
]);
// Configuration
$cookie = new Cookies(cache: new CacheInterface());
// For managing multiple accounts
$cookie = new Cookies(cache: new CacheInterface(),'your_account_name');
// Logging
$logger = new LoggerInterface();
// Synchronize and persist headers
$headerRepositories = new CacheStore(
cache: new CacheInterface(),
key: 'your_account_name',
defaultData: [
'scnt' => 'value',
]
);
// Create AppleClient instance
$client = new AppleClient(config: $config, headerRepositories: $headerRepositories,cookieJar: $cookie,logger: $logger);
// Or use AppleFactory
$factory = new AppleClientFactory(cache: $cache, logger: $logger);
$client = $factory->create('your_client_id', [
'apple_auth' => [
'url' => 'https://your_apple_auth_url',
],
]);
// Custom configuration
$client->withConfig([
'timeOutInterval' => 30,
]);
// Use proxy
$client->setProxy('http://proxy.example.com:8080');