Design pattern for implementing plugins in PHP applications

后端 未结 6 894
温柔的废话
温柔的废话 2021-01-30 23:15

Is there a consensus on how plugins should be implemented in a PHP application?

I\'ve looked into the observer pattern which comes close, it\'s really just a notificati

6条回答
  •  青春惊慌失措
    2021-01-30 23:28

    There is no consensus as in the Silver Bullet sense. For established patterns, you have multiple options like

    • Subject/Observer,
    • Signal Slot,
    • Event Dispatcher or
    • Pipes and Filters

    to name a few.

    Which you use is up to you, but you should make sure your system architecture supports the modularity. Have a look at these slides for some ideas

    • http://qafoo.com/talks/11_06_ipc_spring_modular_application_architecture.pdf

提交回复
热议问题