odan / slim4-skeleton

A Slim 4 Skeleton
https://odan.github.io/slim4-skeleton/
MIT License
439 stars 80 forks source link

ORM for database #52

Closed francescopasin closed 3 years ago

francescopasin commented 3 years ago

Hello. Your work is great and I used it in a quite big project, finding it very well organized and structured. Working with it I struggled sometimes with the repository concept. There is a lot of code replication between different repositiories and lot of times I needed to go and change code in different files. Also CakePhp is not well documented (in the way you use it). May I suggest to use ORM for database communication? It could be more practical and reduce code boilerplate. I found this library http://propelorm.org/ that I think is awesome for different reasons:

Well this is just an opinion :) And I wanted to share my feedback about this project after using it.

One last thing: it would be nice to include in this repo some example of different scenarios and use cases (for example I used a react frontend and the backend only for rest api). It could be useful if someone needs to understand the "correct" way of using this (I can try to share some example and collaborate in this project if you want).

Nice work!

odan commented 3 years ago

Hi @francescopasin Thanks for your feedback.

This skeleton project is intentionally working with repositories to abstract the data access logic and make the core application independent of any data access implementation. Well, this project is "only" a skeleton and not a "framework". You can clone it to modify it as you wish. You can also add any ORM or QueryBuilder you want to use within the repositories. Feel free :-) In my blog you can find alternatives to the CakePHP QueryBuilder.

The latest version of this Skeleton was refactored for API's only. So you may test it and give me a feedback.

PS: I think I will write a blog post about Propel.