goetas/twital
Twital is a PHP template engine that adds Angular-style HTML syntax to Twig. Write cleaner, more expressive templates with custom tags and attributes, then compile them to standard Twig for familiar, fast rendering in PHP applications.
Architecture fit. Twital is not a runtime template engine; it is a source-to-source compiler that sits in front of Twig. It parses HTML templates containing t:* attributes (t:if, t:repeat, t:attributes, t:text, etc.) and emits standard Twig source, which Twig then compiles to PHP as usual. Architecturally that is a clean, well-bounded layer: it does not replace Twig, it feeds it. For any application already on Twig (Symfony, Slim, Laravel-with-Twig, or standalone), the fit is good provided the integration is wired as a loader or pre-compilation step rather than a runtime interception point. The design is essentially a superset DSL, which means the escape hatch is always available — compiled output is plain Twig.
Integration feasibility. Composer-installable, MIT-licensed, latest release 2025-04-25. The primary feasibility questions are version-matrix questions: which Twig major versions (2.x vs 3.x) and PHP versions (8.0/8.1/8.2/8.3) are supported by the current constraints. Because it hooks into Twig's loader/compiler path, framework-specific wiring (e.g., Symfony's TwigBundle loader chain) must be validated, not assumed. The "Repository: unknown" field is itself a supply-chain concern: as TPM I would require the canonical Packagist/GitHub source to be identified and verified before approval, since provenance, CI status, and issue backlog cannot be assessed from the metadata provided.
Technical risk.
t:* attributes. Code review and onboarding friction is real and ongoing.Key questions to resolve before adoption. (1) Exact Twig/PHP support matrix and whether Twig 4 is on the maintainer's roadmap. (2) Is compilation cached and is it build-time or request-time by default? (3) Does generated code respect Twig's sandbox and escaping rules? (4) How are source locations preserved in error reporting? (5) What is the maintainer's stated support policy and historical release cadence? (6) Are compiled templates deterministic and committable?
Stack fit. Best suited to teams with heavy, HTML-designer-facing template estates who want PHPTal/Vue-like ergonomics without abandoning Twig. It is a poor fit for API-only services or teams already standardized on Twig components/UX conventions. Treat it as an internal developer-velocity tool, not a strategic platform dependency — the low opportunity score argues against building core product surface on it.
Migration path. Adopt incrementally and non-destructively:
Compatibility. Pin the package version; pin Twig to the tested major; add a CI job that runs the full template suite against the pinned combination. Verify the custom loader co-exists with framework loaders (namespace resolution, cache invalidation, template inheritance). Confirm that Twig's cache warmer and debug mode behave correctly with compiled artifacts.
Sequencing. (a) Locate and verify the canonical repository; audit open issues and last-commit activity. (b) Two-day spike: one representative template set, build-time compilation, error-path test. (c) Decide on build-time vs. runtime compilation — default to build-time. (d) Pilot one feature team for a sprint; instrument template-authoring time and defect rate. (e) Go/no-go on broader rollout with a documented exit plan.
Maintenance. Low runtime maintenance if compilation is build-time only; the package then behaves like a code generator. Ongoing cost is version-tracking: a Twig major bump may strand the package, forcing either a fork or a template migration. Recommend vendoring or forking as a contingency, and budgeting a small annual "upgrade or eject" review.
Support. Community support is thin. Expect to own your own answers. Mitigate with an internal runbook, a documented subset of supported t:* directives, and at least two engineers trained on the compiler. Do not let knowledge concentrate in one person.
Scaling. Runtime performance is Twig's performance — no regression expected. Compile time scales linearly with template count and should stay in the seconds range for typical estates; watch CI duration as templates grow. Cache compiled output and avoid recompilation in request paths.
Failure modes.
Ramp-up. Low for anyone who knows Twig — the directives are learnable in a day, productive within a week. The hidden cost is ecosystem friction: no linter, no formatter, no editor support, so code review and onboarding take longer than the syntax suggests. Budget for a short internal workshop and a style guide that constrains which directives are permitted, keeping the DSL surface small enough to eject cleanly if the package's maintenance trajectory deteriorates.
How can I help you explore Laravel packages today?