Structuring and wiring repositories in Hanami 2.1


I’m considering Hanami for a new project. To avoid too much refactoring in the future, I’d like to use the repository pattern and keep it as close as possible to what it will be in version 2.2.

On Gitter, I found this: and I’ve been able to replicate the setup in my app. But I’m wondering now, is that a move in the right direction?

1 Like

Check out these projects for current approaches to implementing persistence in Hanami: DecafSucks and Hemo.

I’ve written a three-part blog post explaining the approach used in DecafSucks, but it still needs error-checking and some polish. I’ll post back here when it’s published . . .

1 Like

Those two apps are very helpful, thanks! Looking forward to the blog post.

I also have started the

which I’ll keep updated over time. This includes my personal preferences over official patterns, and is used mostly for educational purposes.

Hope that will help too!


Thanks! That is very helpful indeed. :slightly_smiling_face:

Okay, I finally got my articles in order. You can find them here:

I hope this is helpful. The examples mostly follow @timriley’s DecafSucks example project, so they may be an indicator of what is to come . . .

Comments, feedback, and–especially–corrections are welcome.

1 Like