ElasticEmail.WebApiClient-php
ElasticEmail.WebApiClient-php copied to clipboard
Reusable configuration keys
- It's not so useful to initialize client with string configuration keys, as your examples:
$configuration = new \ElasticEmailClient\ApiConfiguration([
'apiUrl' => 'https://api.elasticemail.com/v2/',
'apiKey' => 'yourApiKey'
]);
More useful:
$configuration = new \ElasticEmailClient\ApiConfiguration([
\ElasticEmailClient\ApiConfiguration::API_URL => 'https://api.elasticemail.com/v2/',
\ElasticEmailClient\ApiConfiguration::API_KEY => 'yourApiKey'
]);
- I think it is better to pass this options via setters and not to do them as required arguments of constructor:
$config = new ApiConfiguration();
$config
->setApiUrl($apiUrl)
->setApiKey($api);
If you do not agree with me I can remove this commit https://github.com/ElasticEmail/ElasticEmail.WebApiClient-php/pull/14/commits/478eb7321d555025eae0e0436313ad9ed98c61c7