Well for Stripe you should use Laravel Cashier, which is built for it. But, essentially, when using a library, you just import it at the top of the file and use it. Of course you can create service classes to wrap around it and use your own API to defer to the expected API, that way you can replace providers easily.
May 27, 2016
2
Level 2
Using an API from a Service
Hey there all! Hope you're all doing well!
I was wondering if there was a best practice when using a third party API with Laravel. For example, if I wanted to use the official PHP Stripe API, is there a better way of using it other than including the file at the top of the controller?
API in question: https://github.com/stripe/stripe-php/releases
Level 52
Please or to participate in this conversation.