ylly/amp-html-bundle
A Symfony bundle for serving AMP HTML pages, providing integration for generating AMP-compliant markup within your application. Useful for projects that need accelerated mobile pages alongside existing Symfony templates and routing.
Architecture fit. ylly/amp-html-bundle is a Symfony bundle, not a Laravel package. It ships a Bundle class, a DependencyInjection extension, and service configuration wired through Symfony's kernel — none of which the Laravel container, service provider lifecycle, or package auto-discovery (extra.laravel) will recognize. There is no Laravel service provider, no config publish tag, no facade, and no documented Laravel usage. The conceptual fit is reasonable: both stacks are Composer/PHP, both render HTML through templating, and AMP conversion is a cross-cutting concern that a middleware or response listener could own. But the deliverable artifact is misaligned with the target stack by design, not by accident.
Integration feasibility. Three viable paths, in decreasing order of cost:
| Path | Effort | Fidelity | Notes |
|---|---|---|---|
Install bundle + symfony/* bridge components into Laravel |
High | Low | Pulls a large Symfony surface (HttpKernel events, DI extensions) alongside Laravel's own. Two competing kernels/containers in one process is a maintenance trap. |
| Extract the AMP conversion logic only (the transformer/parser services) and re-wire in a Laravel service provider | Medium | Medium | Requires reading the bundle source to isolate pure-PHP conversion classes from Symfony-coupled ones. Viable only if the conversion core has no container/event dependencies. |
Use a maintained, framework-agnostic AMP library (amp-toolbox-php lineage) and write thin Laravel glue |
Low–Medium | High | Preferred. Replaces an unmaintained 0-star dependency with something the team can own and audit. |
Technical risk. Elevated and concentrated in five areas:
<amp-img> substitution, boilerplate, canonical linkage). A partially-implemented or outdated converter produces silently invalid AMP that fails Google's validator and degrades rather than helps SEO. Validation must be exercised in CI, not assumed.Key questions for the requester.
Stack fit. Poor as-shipped. The package's identity is "Symfony bundle," and its entire value proposition is Symfony-specific autowiring. In a Laravel codebase it is an inert dependency until someone performs non-trivial adaptation. Treat it as source material, not a dependency. The honest framing for stakeholders: we are evaluating a 300-line reference implementation, not adopting a library.
Migration path. If we proceed, sequence it as an extraction rather than an installation:
composer require only if we accept it as a real dependency; otherwise a git subtree/fork for auditability).HttpKernel response event, extraction is expensive and we should stop here.ServiceProvider exposing a single AmpConverter contract, bound to an interface, resolved from the container. Laravel-native, testable, swappable.Compatibility. Confirm PHP version support against our runtime (8.1/8.2/8.3); older Symfony bundles often cap at PHP 7.x or Symfony 3/4 and will not install under a modern lockfile. Also check for abandoned transitive dependencies — composer why-not and an audit pass are mandatory gates before merge. Note that installing the bundle as a bundle would also drag in Symfony components; avoid this, since we are extracting rather than installing.
Sequencing. Recommend a strict gate order, each with a kill criterion:
This sequencing ensures the integration architecture is ours and vendor-neutral, so swapping the converter later is a one-line binding change — the most important insurance policy given the package's health.
Maintenance. Effectively 100% ours. A 0-star, 0-dependent package has no maintenance cadence to inherit. Budget for a forked converter, a PHP-version upgrade treadmill, and periodic re-validation against evolving AMP spec revisions. If the team cannot name an owner, do not ship it.
Support. No vendor, no SLA, no community forum, no issue triage history to mine for known failure modes. Internal documentation and tests become the only source of truth, which means the spike work must be converted into runbook material rather than discarded. Expect onboarding cost to be entirely self-generated.
Scaling. AMP responses are typically cacheable static-ish HTML, so CDN and edge caching absorb most scale concerns — that is a genuine architectural benefit. The risk is cache cardinality: parallel AMP and non-AMP variants per URL, plus canonical/alternate linkage, doubles the cache keys and complicates invalidation. Conversion cost sits on the render path for cache misses; if the transformer is regex- or DOM-parse-heavy on large pages, tail latency will spike precisely under cold-cache traffic bursts. Profile before enabling broadly.
Failure modes. Enumerate and instrument each:
amp- components get stripped; product must know what disappears from the AMP view before launch, not after.Ramp-up. Low for a Laravel engineer to use (one injected contract), high to own. Realistic estimate: half a day to understand the extracted converter's behavior, one to two days to build the Laravel provider, middleware, and test harness, and ongoing small-slice effort for validator upkeep. The dominant cost is not learning the package — it is compensating for the absence of anyone else who has ever run it.
Recommendation. Do not integrate ylly/amp-html-bundle as a dependency. Use it as a reading reference for AMP conversion mechanics if AMP is independently justified, and build a Laravel-native adapter over a framework-agnostic converter that we control. Gate the entire effort on a Product/SEO answer to "what is AMP buying us," because the package's technical health and AMP's strategic trajectory both point the same direction: the default answer should be no, and proceeding should require a specific, documented reason.
How can I help you explore Laravel packages today?