DEV Community

Discussion on: PHP - Create your own PHP PSR-14 event dispatcher

 
fadymr profile image
F.R Michel • Edited

What if there are two ways to authenticate on your application, Login and password | JWT ? you would have to duplicate the code. With a single event you fixes the problem.
In addition, give you the possibility of more flexibility without modifying the core of your code.

Thread Thread
 
dopitz profile image
Info Comment hidden by post author - thread only visible in this permalink
Daniel O.

If I have two ways to authenticate I would separate the use-case specific logic into different (application) services and the shared logic into a domain service class.

Some comments have been hidden by the post's author - find out more