Closed cukabeka closed 7 years ago
You can create a credentials provider that loads from an ini file in any directory by calling CredentialsProvider::ini
. The first parameter is the profile name in the ini file and the second is the path to it.
use \DTS\eBaySDK\Credentials\CredentialsProvider;
$provider = CredentialsProvider::ini('default', '<path_to_your_ini_file>');
$service = new Services\TradingService([
'credentials' => $provider,
'siteId' => Constants\SiteIds::US,
]);
Because it can be expensive to keep accessing a file you can cache the results in a memozie function. This way the file is only loaded once.
use \DTS\eBaySDK\Credentials\CredentialsProvider;
$provider = CredentialsProvider::ini('default', '<path_to_your_ini_file>');
// Cache the results in a memoize function to avoid loading and parsing
// the ini file every time a service is instantiated.
$provider = CredentialsProvider::memoize($provider);
Hi,
I wonder how to tell my script to use a configuration file that is in another place than default.
CredentialsProvider.php
To be more precise, it would help a lot to know how to pass parameters to this ini function so that I could use credentials from any place relative to the current script call.