Roots Discourse

Data abstraction layer (model)

Hey,

I’ve been looking to get into Wordpress development as a Laravel developer because many CMS’s are not flexible or customer friendly enough. Whilst looking into “Wordpress frameworks” I came across Sage & Timber.

What I like about Timber is the model database abstraction layer for posts and calling {{ post.title }} in the twig view rather than having some raw php Wordpress function.

What I like about Sage is the opinionated structure with namespaces, but what Sage is lacking is the model abstraction layer which Timber has.

Are there any plans to add such models into Sage? It’s the only reason I’m not seeing myself use Sage yet.

Let me know!

1 Like

Have you read about Composers in Sage 10? They aren’t models per se, but they certainly allow for a layer of abstraction and allow you to avoid calling functions in your templates: https://roots.io/working-with-composers-in-sage-10/

If you’re looking for simplified access to WP stuff, you might also have a look at @Log1x’s sage-directives: https://log1x.github.io/sage-directives-docs/usage/wordpress.html

Thanks! The directives will do the job!