Hello, i think you can use a connection manager like Eloquent or implement your own.
I have suggest the same approach in this other topic PDO per user Slim 4
This way it’s simple to add new connections and select the right connection for each query.