Open christoph-kluge opened 4 years ago
For now I use a small proxy/factory to ensure this behavior:
class IpStackFactory
{
private $apiKey;
public function __construct(string $apiKey)
{
$this->apiKey = $apiKey;
}
public function resolve(string $ip): IpStack
{
$ipStack = new Ipstack($ip, $this->apiKey);
$ipStack->resolve('country'); // calling this so I can ensure that I have an resolved call
return $ipStack;
}
}
First of all, thanks for creating this little nice package. Currently there is a hard dependency between the ipstack client and the ip lookup call itself.
I would suggest and would love to see this seperated so you could auto-resolve the client with the api key w/o calling the configuration repository all the time. Here is a possible example: