Published 1 year ago by nate.a.johnson
I need to build a wrapper on Bill.com's old rest API to do things like customer creation, credit card and ACH collection, invoicing, etc. We can't use Stripe and from what I can tell there isn't a library out there for this service other than a github repo from a few years back that has only a handful of commits.
I see options like using curl or guzzle in a nice Laravel wrapper, but I'd love to hear what others have done for something similar. I've done a bit of digging into the Stripe PHP library and a similar approach to what they have done is an option as well.
From what you are describing, I would probably pick up the juices out of this old github repo and use it in my own implementation.
However if you think the code in there is pretty good and should work with the newest PHP versions, maybe the fastest way would be to decorate their classes - so their class would be the constructor dependency in yours.
I would use Guzzle, since it is easily testable, follows the PSR standards and can harvest not only curl, but also php streams under the hood. And maybe I would even create the composer package, trying to share the hard work with the whole php community.
If I work with Laravel framework, I would probably wind up creating additional service provider class to encapsulate my API classes into the Laravels' DI container.