dimanche 7 août 2016

Repository pattern with Laravel 5

I am trying to bring some good practices to my new project. As the title says, I am using Laravel 5.

I have created a couple of Repositories classes in app/Repositories like SeriesRepository, CommentRepository etc. My idea doing this is to abstract the database calls, so I can use Eloquent or the query builder or even raw SQL if I wish without having to change queries in thousands of places in the code.

Since I will be releasing this project as Open Source, I decided to add an interface for each repository. This way anyone who might use the project can create their own version of a specific repository and just implement the interface. Is this an overkill? Is this just overengineering? Should I just skip the interfaces?

Aucun commentaire:

Enregistrer un commentaire