Skip to content

Config value http_client_handler to support runtime resolving (via a callable maybe) #1174

@lezhnev74

Description

@lezhnev74

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions