walkor / workerman

An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols.
http://www.workerman.net
MIT License
11.1k stars 2.26k forks source link

PSR-11 dependency injection containers compatibility with Workerman workers #697

Open raghuveer opened 2 years ago

raghuveer commented 2 years ago

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

walkor commented 2 years ago

Workerman works fine with them.

raghuveer commented 2 years ago

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

walkor commented 2 years ago

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

raghuveer commented 2 years ago

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

walkor commented 2 years ago

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.

raghuveer commented 2 years ago

sure will do, thank you