DEV Community

loading...

Discussion on: Does repository pattern make sense when using it in Laravel?

Collapse
ben profile image
Ben Halpern

Rails works the same way, where ActiveRecord already acts as the standard object mapping on top of the database. But I saw a talk where someone described eschewing ActiveRecord for the repository pattern and it was working just fine for them.

I don't remember all the details, but my thoughts are that this is probably totally possible, but if Laravel is anything like Rails, swimming against the current is just a little awkward. You won't be facing the same problems as most of the rest of the community.

The repository pattern seems like a wonderful approach, but I wouldn't break from the framework's norm without a lot of conviction for doing so.

Would love to see some answers from folks with more insight into these things.