feat: add Twig template engine driver as sibling to Latte#88
Merged
Conversation
- New marko/view-twig package with TwigView, TwigEngineFactory, ModuleLoader (Twig\Loader\LoaderInterface), and TwigViewConfig - Refactor marko/view: remove Latte-biased extension/.strict_types defaults from shared config; drop ViewConfig::strictTypes() accessor - Refactor marko/view-latte: introduce LatteViewConfig for Latte-only settings; add config/view.php shipping extension/.latte + strict_types - Composer conflict declaration enforces one-driver-at-a-time at install - NoDriverException now lists both marko/view-latte and marko/view-twig - Skeleton composer.json suggests both drivers (Twig listed first) - Docs site: register Twig as Shiki language for syntax highlighting Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 27, 2026
markshust
added a commit
that referenced
this pull request
May 27, 2026
…mark ready Closes the gap left by deleting the conflict-blocks pilot task in the previous commit. Tasks 005-025 each decrement by one (005 -> 004, 006 -> 005, ..., 025 -> 024). All cross-references updated: - File names - Task headers - Depends-on fields - _plan.md task table - Prose references Also updates two stale references to view-twig in Discovery Notes that predated PR #88 / #92 (both drivers are now in monorepo, view rollout is no longer a single-driver case). Status: planning -> ready (plan-orchestrate expects this). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
marko/view-twigdriver package — full Twig 3 engine with strict_variables (loud errors), HTML autoescape, and module-namespaced template resolutionmarko/viewto be genuinely driver-neutral — removed Latte-biasedextensionandstrict_typesdefaults; droppedViewConfig::strictTypes()accessormarko/view-latteto ship its own config and newLatteViewConfigclass (architectural symmetry withTwigViewConfig)Architectural changes
Interface/driver split tightened. Before this PR,
marko/viewshipped.latteas its defaultview.extensionand a Latte-specificstrict_typesflag — biasing the interface package toward one driver. Now each driver ships its ownconfig/view.phpwith its own defaults;marko/viewonly owns the truly shared keys (cache_directory,auto_refresh).Mutual exclusion at install time. Both drivers declare
"conflict": {"other-driver": "*"}in composer.json. Installing both fails loudly atcomposer installrather than at runtime viaBindingConflictException.Driver-specific config accessors live with their drivers. New
TwigViewConfig(in view-twig) andLatteViewConfig(in view-latte) host their respective driver-only settings. No driver-specific accessors pollute the sharedViewConfig.No silent fallbacks. Every value
TwigViewConfigandLatteViewConfigexpose goes throughConfigRepositoryInterface— missing keys throwConfigNotFoundException. All defaults live in config files, never in code.Twig defaults (config/view.php)
extension: '.twig'strict_variables: true— undefined variables throw, matching Marko's loud-errors principleautoescape: 'html'— safe default for web appsdebug: falsecharset: 'UTF-8'Users override any of these in their app-level
config/view.php.Cross-cutting updates
NoDriverExceptionnow lists bothmarko/view-latteandmarko/view-twigwithcomposer requirecommandssuggestblock (Twig first for broader ecosystem familiarity); skeleton stays engine-agnostic with no hard view-driver deptwigas a Shiki language for syntax highlighting (built-in, no custom grammar needed)docs/src/content/docs/packages/view-twig.mdmirrors the existingview-latte.mdstructuremarko/viewandmarko/view-lattedocs updated to reflect the driver-neutral interface package and the newLatteViewConfigclassOut of scope (follow-up plan)
marko/admin-panelships only.lattetemplates — users installing view-twig instead of view-latte would hit template-not-found errors. The next plan extracts admin-panel templates into engine-specific sibling packages (marko/admin-panel-latte,marko/admin-panel-twig) and adds aCrossEngineTemplateParityTestinmarko/view's test suite to mechanically enforce parity for all core engines.Test plan
marko/viewtests pass (43 tests)marko/view-lattetests pass (28 tests — refactoredLatteEngineFactorymocks updated)marko/view-twigtests pass (46 tests covering config, engine factory, module loader, view, module bindings, package structure)marko/skeletontests pass (16 tests including new suggest-block assertions)twiglanguage🤖 Generated with Claude Code