log1x/sage-directives
Sage Directives adds a collection of handy Laravel Blade directives to Sage 10 WordPress themes—@role, @user, @post, @loop, @title, @thumbnail, @svg and more—letting you write cleaner templates with familiar WordPress and Laravel helpers instead of verbose PHP.
Package: log1x/sage-directives — a Blade directive library for Sage (Roots) WordPress themes, exposing WordPress and Advanced Custom Fields APIs as expressive template directives (@field, @image, @posts, @shortcode, @svg, etc.).
Architecture fit: Thin, additive adapter layer. It sits in the presentation tier of a Sage 10/11 theme (Acorn + Blade) and wraps existing WordPress/ACF functions rather than introducing new infrastructure. That makes it low-coupling and easy to reason about architecturally: no database footprint, no runtime services, no queue or storage concerns. It is not a general Laravel package — directives call global WordPress functions, so it is only viable inside a WordPress-bootstrapped Blade context.
Integration feasibility: High. Composer-installable, auto-discovered via Acorn's package manifest, no configuration required for the common directives. Requires ACF Pro for the field-oriented directives (a paid-license dependency that is frequently the real gating item, not the package itself). A Blade-fluent developer can integrate in an afternoon; effort concentrates in template refactoring rather than setup.
Release assessment (v2.0.7): Purely a patch. One functional bug fix — @image option parsing when arguments are empty strings, variables, or function calls — plus a docblock/typo correction and one first-time contributor. No new directives, no removed or renamed directives, no deprecations, no signature or output-contract changes beyond correcting malformed edge-case rendering. Semver-compatible with 2.x; drop-in for anyone on ^2.0. The fix itself is a reliability signal: it confirms the directive argument parser has had sharp edges with dynamic expressions, which is exactly how most teams use @image (passing a variable field value plus an options array).
Technical risk: Low-to-moderate.
@shortcode, @svg, @image) should be reviewed once and codified.Key questions for the team:
composer.json constraints?@image with variable or empty-string options anywhere (i.e., are we in the blast radius of this fix)?Stack fit: Appropriate only for Sage 10/11 themes using Acorn and Blade. Teams on classic PHP-template Sage 9, Timber/Twig, or standalone Laravel should not adopt it — the directives assume WordPress globals and ACF are loaded. For the target stack it is a strong fit: it reduces template noise and standardizes how field and query data reach the view.
Migration path: Incremental and reversible, which is the main appeal for a TPM. Replace raw get_field(), wp_get_attachment_image(), and new WP_Query blocks in Blade templates with directives file by file; keep raw calls where semantics are unusual. Pin ^2.0 in composer.json and commit the lockfile. v2.0.7 requires no code changes on our side — a routine composer update log1x/sage-directives is sufficient.
Compatibility: Confirm exact composer.json constraints (PHP, illuminate/support, Acorn) against our runtime before bumping. Note that the @image fix changes rendered output for previously-malformed argument cases — the change is a correction, but it is still a markup diff on affected templates. Clear compiled Blade views after deploy so cached templates pick up the new directive behavior.
Sequencing:
@image usages passing variables, empty strings, or function calls — those are the ones whose output may shift.loading attributes, alt text).Maintenance: Very low ongoing cost. Small code surface, infrequent releases, patch-level churn. The real maintenance burden is external: ACF Pro renewals and Sage/Acorn major upgrades, which will eventually force a directive-compatibility check. Keep the package in the lockfile and treat upgrades as routine patch bumps unless the changelog shows a minor/major.
Support: Community-only — GitHub issues and PRs, no SLA, no vendor. Assign an internal owner (typically the theme lead) who watches releases and can triage rendering regressions. Given the low release cadence, a quarterly review is adequate.
Scaling: Effectively zero runtime overhead beyond the underlying WordPress calls the directives wrap; directives compile into cached Blade views, so per-request cost is the same as hand-written PHP. Scales with the theme, not with traffic. No new caching, storage, or observability requirements.
Failure modes to plan for:
Ramp-up: Low. A developer familiar with Blade and WordPress needs roughly half a day to be productive and a few days to be fluent across the directive catalog. Produce a short internal cheat sheet of the directives we sanction, the ones we forbid, and the escaping expectations — this is the highest-leverage documentation investment and prevents drift back to raw function calls.
Recommendation: Adopt and keep current on 2.x, including v2.0.7. The release is a low-risk correctness fix worth taking, with the only action item being a visual regression check on templates using @image with dynamic options.
How can I help you explore Laravel packages today?