dimanche 29 octobre 2017

Best Location In Laravel For Third-Party API Connection

I'm writing a Laravel application using one or more third-party APIs when it suddenly dawned on me. Where is the best place within the Laravel application structure to setup the API connection in order to consume it from within my Controllers? Would you use a Service or put the logic somewhere else?

$this->api = new RestApi();
    ->setUrl(getenv('API_REST_URL'))
    ->setUsername(getenv('API_USERNAME'))
    ->setPassword(getenv('API_PASSWORD'))
    ->connect();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire