Apple Client is a PHP library that integrates the Saloon HTTP client to simulate Apple browser client interactions with various Apple services. It provides a simple and flexible interface for developers to easily integrate Apple's authentication, account management, and other related functionalities into their applications.
Note: Before using the Apple Client library, you may need to reverse engineer Apple's login process and find the algorithm for encrypting account and password.
- Apple ID Authentication
- Account Management
- Phone Number Verification
- Security Code Validation
- Flexible Configuration Management
- Robust Error Handling
- PHP 8.2 or higher
- Composer
- ext-simplexml
- ext-dom
- ext-libxml
Install Apple Client using Composer:
composer require weijiajia/apple-client
- Create an AppleClient instance:
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');
- Perform Apple ID Authentication:
// login
$response = $client->authLogin('[email protected]', 'your_password');
// Two-factor authentication
$response = $client->verifySecurityCode('your_security_code');
// get token:
$response = $client->token();
This project is for learning and research purposes only. Do not use it for illegal purposes. Usage may violate Apple's terms of service, please use with caution. Ensure that your network environment can access Apple websites normally.
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or suggestions, please contact: