From controller call your service which will orchestrate everything required to fulfill this task. Credentials go into .env file.
May 4, 2020
2
Level 3
The best way for my problem (One class using multi external api service)
Hello,
I search the best way, to implement all external services.
Example :
I would like to create a method to get price by all registrar api (InternetBS, NameBright, cloudflare, GoDaddy, etc..)
i imagine something like this :
//Get Information about domain :
$domain = $request->input('domain');
$registrarService->getInfo($domain);
//Register a domain :
$registrarSelected = $request->input('registrar');
$registrar = new $registrarSelected();
$registrar->register($domain);
and the method returning :
Registrar 1 : All informations from api Registrar 2 : All informations from api (etc...)
but my problem is how to :
What the best : controller / Interface / Trait / Service ?
how call all api with specific crendential (env variable ? like INTERNETBS_TOKEN=****** , .... )
What the best way? Thank lot
Please or to participate in this conversation.