Skip to content

Symfony & Dependency injection #666

Answered by Lukasss93
PaulCombal asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, yes, there is an undocumented configuration: "container".
This configuration is done automatically on Laravel and Symfony frameworks.
If you want to use an external service container, you have to set it in Nutgram's configuration or use its container.

Using Nutgram's container:

$bot = new Nutgram('your-token');
$bot->getContainer()->set(CustomService::class, new CustomService());

Set a custom container:

$config = new Configuration(container: $yourContainer);
$bot = new Nutgram('your-token', $config);

This mode is done automatically by the frameworks:

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by PaulCombal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants