I am using Laravel and want to customize the http client used by the package.
Config value http_client_handler allows only in-place instantiation like new MyHandler() as at the config loading step the container has not finished loading all the dependencies.
My point is that I need to configure the client at run-time, upon using Telegram bot.
So far my ideas:
- make config value http_client_handler to accept callable to resolve the client later at runtime
- remove final from BotsManager so I can override its behaviour to resolve client at runtime
- maybe something else?
p.s. within BotsManager config dependencies are resolved as new Api(...) so no opportunity to inject another implementation via the container.
I would be grateful for any clues on how to swap the http client at runtime?
I am using Laravel and want to customize the http client used by the package.
Config value
http_client_handlerallows only in-place instantiation like newMyHandler()as at the config loading step the container has not finished loading all the dependencies.My point is that I need to configure the client at run-time, upon using Telegram bot.
So far my ideas:
p.s. within
BotsManagerconfig dependencies are resolved asnew Api(...)so no opportunity to inject another implementation via the container.I would be grateful for any clues on how to swap the http client at runtime?