For a start, I would wrap the api calls up in a class, have the class implement an interface, and then code to this interface in your project. This way, all the api calls will be in a single place and if you swap out the api later, you can simply make a new implementation of the interface.
Feb 7, 2017
4
Level 1
Creating a package for an API
Hello!
I found this train API online that I want to use in my Laravel project. I was wondering what is the best way to integrate it? Doing some curl call straight in my controllers definitely does not seem to be a great idea. I'm never done such a thing before, should I create a package? If yes any good ressource about that?
Thank you!
Level 47
Please or to participate in this conversation.