tiny-pixel/acorn-models
Acorn Models brings Laravel-style Eloquent modeling to WordPress through Roots Acorn. Define models for posts, custom post types, taxonomies, terms, and users; add relationships, scopes, and fluent queries; and build cleaner, more maintainable themes and plugins with a familiar API.
wp_posts / wp_postmeta / wp_terms" that would otherwise cost a sprint or more to write and maintain. MIT license, Composer-installable, no vendor lock-in — the cheapest way to answer "should we build our own abstraction?" is usually "no, fork this one."WP_Query loops and get_post_meta calls in templates.WP_Query idioms first. That is a real, quantifiable reduction in ramp time and a factor in staffing decisions.WP_Query/the_content, and not a performance strategy. Documenting these prevents the package from being over-sold internally.Adopt when all of the following hold:
Post::with('meta')->where(...) than WP_Query args arrays.postmeta table and posts-table polymorphism (revisions, autosaves, attachments, nav items) require disciplined scoping and default filters.Look elsewhere when any of these apply:
WP_Query, wpdb, Timber, or WPGraphQL. There is no value here outside the Roots ecosystem.WP_Query filters and global state. Eloquent bypasses those hooks; you will get subtly wrong content and hard-to-trace bugs.To executives: This is a small, MIT-licensed accelerator for one specific stack — WordPress sites built on the Roots/Sage + Acorn framework. It lets our Laravel-fluent developers build content-driven features faster by querying WordPress data with the same patterns they already use, avoiding a custom bridge we would otherwise have to write and maintain ourselves. The cost is negligible; the risk is vendor concentration (a small open-source project with a single maintainer), which we contain by forking the source, pinning the version, and budgeting a few days a year of internal upkeep. It is not a strategic dependency and it is not reversible-costly — if it stalls, we swap to WP_Query or a GraphQL layer behind our own interface.
To engineering: Thin mapping of WordPress core tables to Eloquent models — models, relationships, scopes, eager loading. Use it as a read/query layer for archives, listings, filters, and API payload shaping. Do not use it as a write layer for posts or users unless we explicitly re-implement the WordPress hooks and cache invalidation we'd be bypassing. Assume we own the fork: expect to patch it, pin it, and keep an integration test around the models we rely on. If a feature depends on plugin behavior or WP_Query filters, that feature stays on WP_Query.
How can I help you explore Laravel packages today?