Skip to content

Instantly share code, notes, and snippets.

@odan
Last active January 15, 2022 11:22
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odan/c8bee474b0054a06776481a6c8de1d8f to your computer and use it in GitHub Desktop.
Save odan/c8bee474b0054a06776481a6c8de1d8f to your computer and use it in GitHub Desktop.
Slim 4 Tutorial
@odan
Copy link
Author

odan commented Oct 6, 2020

@blacktornado I think it makes no sense to create a new $app instance, because per request there should be only one Slim instance.
If you have further technical questions, please create an issue here: https://github.com/odan/slim4-tutorial/issues

@marcusball
Copy link

marcusball commented May 29, 2021

This is a great tutorial, thank you so much!

Is there any particular reason to separate the Read and Create into separate repositories and services? In this example, would it be against design patterns to use a single UserRepository containing both insertUser and getUserById methods? Similarly, is it suggested to not combine the Service methods into a single UserService?

@odan
Copy link
Author

odan commented May 29, 2021

Hi @marcusball Please note that this is not an Active-Record (anti-) pattern. The shown pattern follows Command–query separation (CQS) on routing level. So read and write access is separated. To respect the SOLID (see SRP) principles, the service class is responsible only for one specific task (use case) and not more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment