artkonekt / concord

Laravel extension for building modular applications where modules are decoupled, re-usable and easily customizable
MIT License
211 stars 13 forks source link

Hooks? #10

Open elfeffe opened 4 years ago

elfeffe commented 4 years ago

Does it supports Hooks? I have found this package https://github.com/tormjens/eventy But does your package offers that functionality?

fulopattila122 commented 4 years ago

No, apps written with Concord are typically using the default Laravel Event system to achieve such functionality. Concord itself fires a couple of events and also supports apps/modules to disable events.

Nevertheless, you can use the mentioned package along with Concord without any problems.

Does this properly answer your question?

elfeffe commented 4 years ago

Sorry, but can you show me how to do that? Because the conventional approach is very criticized because “listeners but not return values”. What I need is to create some event getPaymentMethods and the plugins must return their methods. Do you have any example?

fulopattila122 commented 4 years ago

As an example, the Vanilo Payment module (which is built on top of Concord) is using the registry pattern to achieve such functionality: https://github.com/vanilophp/payment/blob/master/src/PaymentGateways.php#L22

And any plugin for the payment module can register itself with PaymentGateways::register(...) Example plugin registering itself: https://github.com/artkonekt/vanilo-euplatesc/blob/master/src/Providers/ModuleServiceProvider.php#L26

elfeffe commented 4 years ago

Great, thanks a lot

elfeffe commented 4 years ago

@fulopattila122 I didn't see you are the developer, I have been following Vanilo for some time, from the first beta. When do you plan to release the payments ans shipping modules? I think I can use them in my project.