jdecool/twig-constant-accessor-bundle
Symfony bundle that integrates a Twig extension for reading PHP class constants and enum cases directly in templates. It exposes a dedicated accessor function so shared values can stay in PHP while remaining easy to use in Twig, without writing custom extensions.
Architecture fit — poor, and 1.10.0 makes it marginally worse. This is a Symfony bundle, not a Laravel package. It ships a Bundle subclass plus a DI extension and compiler pass that register a Twig extension from config/packages/*.yaml. Laravel has no bundle concept, no compiler passes, and no YAML package config; the package's registration mechanism has no counterpart in our framework. The 1.10.0 release adds a TwigConstantAccessorBundle PHP attribute — a marker-style registration affordance for attribute-driven DI, which is a Symfony-ecosystem idiom. It does not add a service provider, a Laravel package manifest, facade, or config stub. The change therefore deepens the Symfony-specific surface by one more convention we would have to discard or reimplement, and moves nothing toward Laravel compatibility. Twig itself remains a second-class citizen in Laravel — Blade is the default engine, so adopting this still requires we already run Twig via a bridge such as rcsofttech/twigbridge, a separate, independently-maintained dependency with its own health question.
Integration feasibility — low, and unchanged by this release. The bundle's actual deliverable is still one Twig extension exposing class constants, with an alias/config layer for shortening Vendor\Package\Class::CONST to something template-friendly. That remains roughly a single class and a config array. 1.10.0 does not touch that deliverable — the feature surface is a registration ergonomic for Symfony users. Integration cost remains entirely in re-hosting Symfony packaging conventions into a Laravel service provider, not in the functionality. We should also verify what consumes the new attribute: the release note is a single bullet with no migration guidance, and attribute-based bundle registration is not a core-Symfony convention, so either the package targets a specific Symfony version/config style or the attribute is an inert marker. Either way it is not portable to us.
Technical risk — abandonment remains the headline; 1.10.0 introduces a provenance question instead of resolving one. The prior assessment recorded the repository as archived, with 9 stars, 0 dependents, and a last release of 2024-05-02. A new 1.10.0 tag is inconsistent with a genuinely archived, frozen repository. Three explanations are plausible and we cannot distinguish them from the release note alone: (a) the archive flag was lifted or was stale in our source data, (b) the release came from a fork or a transferred namespace publishing under the original name, or (c) the version is a backfill/retag of pre-archive work. Each has different implications for supply-chain hygiene. Until provenance is verified — tag signature, maintainer identity on the commit, whether the Packagist entry points at the same repository we assessed — the trust posture should be treated as unchanged, and the release should not be read as evidence of a renewed maintenance commitment. The good news is unchanged: blast radius is small, since the package reads constants and renders scalars, with no meaningful RCE or data-exposure surface. The real risks remain (a) no security patch stream, (b) no compatibility work for future PHP/Twig majors, and (c) introducing an audited-graph dependency whose ownership chain we cannot currently explain.
Key questions.
constant('FQCN::NAME') function does not? The built-in has covered the core case for years; the bundle only adds alias ergonomics.TwigConstantAccessorBundle — a Symfony version or third-party loader we do not run — and does its presence change any runtime behavior, or is it purely declarative?Verdict: do not adopt as a dependency. The 1.10.0 release does not alter the verdict — it is a Symfony-scoped ergonomic addition to a package that has no Laravel integration path. Treat it as a reference implementation at most, and treat the release as a provenance item to verify rather than a health signal.
Stack fit. Three viable shapes, in descending order of preference, unchanged by 1.10.0:
{{ constant('App\\Domain\\Order::STATUS_PAID') }} directly, or expose a small view model / config array through a view composer. Zero new dependencies, zero fork obligation. The new attribute accrues no benefit here.app/Twig/ConstantAccessorExtension.php, register it from AppServiceProvider or the Twig bridge config. This preserves the alias ergonomics — the only thing the bundle actually adds — while we own the code outright. If we copy, copy from the pre-1.10.0 shape; the attribute is Symfony scaffolding and has no meaning in our container.composer.json replace or a patch entry so it cannot drift. A fork now has to make a deliberate decision about the attribute class: keep it (dead code we carry for no reason) or strip it (divergence from upstream we must remember at every future sync).Migration path. There is nothing to migrate from — this is a greenfield dependency, and 1.10.0 is not a migration event for anyone. The practical sequence remains: inventory whether Twig is present and which bridge version; if Blade, close the ticket; if Twig, spike option 1 against the real templates, and only fall through to option 2 if alias shortening is genuinely required by template authors.
Compatibility. Before any fork, read the composer.json at the 1.10.0 tag specifically — not at whatever commit we previously inspected — for its PHP, symfony/*, and twig/twig constraints, and diff them against the prior release. An attribute-based registration helper typically implies a floor bump on the Symfony side, which is exactly the kind of constraint that conflicts with the Symfony components Laravel 11 pulls in transitively. If the release tightened a symfony/* range, the fork effort grows: expect to widen or drop those constraints, and note that a version-constraint change is a more consequential part of this release than the attribute itself.
Sequencing.
constant() and PHP enums on two or three real templates.Maintenance. If the archive flag is genuinely lifted, we would still be inheriting a project with no dependents and a single-bullet release cadence; if it is not, we inherit the maintenance burden on day one. The consolation is unchanged and decisive: the code is small enough that a rewrite is cheaper than a fork audit, which is why option 2 dominates. Budget a recurring line item for "review on Twig major" regardless of which option we pick — Twig extension signatures have changed across majors and an unmaintained extension is a silent breakage waiting for a framework upgrade. Add a one-off line item now for the provenance check on 1.10.0.
Support. Effectively none. Near-zero stars and zero dependents means no Stack Overflow corpus, no issue history to mine, and no upstream maintainer to escalate to. The 1.10.0 release note is a single bullet with no upgrade guidance and no linked issue — consistent with a project that does not operate a support process. Any defect is ours to diagnose from source.
Scaling. Runtime cost is negligible and unchanged — Twig extensions compile into the template's PHP and constant lookup is O(1) at render. The attribute is declarative and compiles away. The scaling concern is operational, not computational: the alias map becomes shared configuration that multiple teams depend on. Changes to it require a config/compiled-view cache clear in every environment, and a stale compiled template will render the old mapping. Bake php artisan view:clear (or the bridge equivalent) into deploys that touch the alias config.
Failure modes.
symfony/* or PHP floor, a casual composer require may resolve differently than expected, or fail late against Laravel's transitive Symfony components.__toString surprises in output.Ramp-up. Near-zero for developers — the API is one function. 1.10.0 adds nothing a Laravel developer would learn or use; if anything it adds a small clarifying cost, since a newcomer skimming the tag will encounter a registration concept that does not exist in our stack. The hidden cost remains discoverability: without documentation, "which alias maps to which class" becomes tribal knowledge concentrated in whoever wrote the config. Mitigate with a single documented registry file and a convention that aliases mirror domain names.
Recommendation. Decline as a dependency; the verdict survives 1.10.0 unchanged. The release is a Symfony-scoped ergonomic addition plus a possible constraint change, and it does not address — let alone resolve — the framework mismatch, the abandonment posture, or the near-zero adoption. Before closing, spend thirty minutes verifying 1.10.0's provenance and recording the finding, because an anomalous release against an archived project is the kind of thing we want in the assessment rather than discovered later in an audit. If Twig is in play and template authors genuinely need constant access, implement the extension in-house in under a day, based on the pre-1.10.0 behavior, and keep the dependency graph clean. Revisit only if Twig becomes a first-class part of our stack, provenance is clean, and a maintained successor package emerges.
How can I help you explore Laravel packages today?