workerman icon indicating copy to clipboard operation
workerman copied to clipboard

PSR-11 dependency injection containers compatibility with Workerman workers

Open raghuveer opened this issue 4 years ago • 7 comments

Hi,

I am interested to know how Workerman workers behave when we have PSR-11 dependency injection containers in the php application?

PSR-11 specification: https://www.php-fig.org/psr/psr-11/

popular containers include:

  1. Laravel container
  2. PHP-DI (https://php-di.org/) etc...

please check and share your inputs

Thank you

raghuveer avatar Dec 21 '21 04:12 raghuveer

Workerman works fine with them.

walkor avatar Dec 21 '21 05:12 walkor

This means, my php class to extend Worker class, that has to be called similar to http server or web socket server example right?

raghuveer avatar Dec 21 '21 05:12 raghuveer

This means, my php class to extend Worker class, that has to be called similar to http server or web socket server example right?

Sorry, I can't understand what you said

walkor avatar Dec 21 '21 06:12 walkor

what I meant is,

my class has psr-11 compatible dependency injection container utilized in it, so when integrating workerman, we will define number of worker instances know, and when we do that, that many instances happen with the same dependency injection container in each?

I hope, my queries will be cleared as I integrate workerman with my code over and above trying existing code samples, will try soon

raghuveer avatar Dec 21 '21 16:12 raghuveer

I don't know much about Laravel container/PHP-DI, so I can't give you a clear answer. If you want to know about something with them, the best way is to actively test them.

walkor avatar Dec 22 '21 06:12 walkor

sure will do, thank you

raghuveer avatar Dec 22 '21 07:12 raghuveer