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.
First, a necessary reality check: this is a Symfony bundle, not a Laravel package. There is no service provider, no facade, no config/amp-html.php auto-merge. You can't composer require ylly/amp-html-bundle into a Laravel project and expect anything to happen — the bundle class simply won't be loaded. So "getting started" for a Laravel developer really means extracting what the bundle does rather than using it.
The practical path:
DependencyInjection/ and any Services/ or Converter/ classes. The conversion work is almost certainly delegated to lullabot/amp (a Masterminds/html5 + QueryPath pipeline that rewrites <img> → <amp-img>, <video> → <amp-video>, etc.). The bundle itself is thin glue.lullabot/amp has been unsupported for years./amp/... route, with <html ⚡>, <link rel="canonical">, and the required AMP boilerplate.If you must integrate, wrap the converter in a small AmpHtmlConverter service bound in your AppServiceProvider, and hide it behind an interface so you can swap it later.
{{ content|amp }} or similar). In Laravel, register a custom Blade directive @amp($html) that resolves your converter service and echoes the result.ConvertContentToAmp) fired on model save, and store the result in a body_amp column. Render-time conversion will bite you on cache misses and list pages.resources/views/amp/show.blade.php with the AMP boilerplate and @yield/@section for the converted body, plus a route group (e.g. /amp/{slug}) so the canonical desktop page can point to it via <link rel="canonical"> and <link rel="amphtml">.DependencyInjection/Configuration.php — custom components like amp-carousel or amp-iframe need to be whitelisted or they get stripped.amphtml-validator (the official npm tool) or a PHP equivalent to your test suite and validate a handful of representative outputs. Don't trust the converter — it emits close to valid AMP, not always valid AMP.composer require will succeed but do nothing useful. The bundle's DependencyInjection extension is only invoked by Symfony's kernel. In Laravel you'll get an unused package plus dead autoload entries. Skip the bundle; take the ~30 lines of conversion glue and leave the rest.lullabot/amp, which is itself deprecated. Treat it as reference code, not a dependency you want in production in 2024+.<html ⚡> in templates, unescaped & in URLs, inline <style> the converter refuses to hoist, or <script> tags it silently drops. Run the validator on the raw input first when debugging.How can I help you explore Laravel packages today?