Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TheOtttema's avatar

API with multiple credientials for the same API

Hello guys, I have a question about external API connections with multiple connections to the same api.

SITUATION: I have a Laravel app that must connect to an external API. So far it’s not that difficult, there is even a wrapper on GitHub that I can use (github.com/homedesignshops/laravel-bol-com-retailer). But here’s the catch. I have multiple accounts on this platform so I need multiple connections. I can rewrite the main class so the wrapper has 3 connections in one singleton that I can call and by specifying a key I can call a single connection. This feels a bit hacky and I think there is a better way, maybe by using the service container. If the service container is the way to go, then please point me in the right direction, because I haven’t used that a lot.

WHAT I HAVE DONE: I have rewritten the class so it authenticates with multiple accounts. But as explained this feels overly complex.

0 likes
0 replies

Please or to participate in this conversation.