[Routing] [HttpKernel] [FrameworkBundle] Static Site Generation #10
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.
This PR allows a route to be defined as "static generated".
A static generated route is dumped on a storage thanks to a Symfony command:
static-site-generation:generate.With a simple NGINX / Caddy configuration, the generated files could be served directly.
Example with Caddy :
A good use case for this feature is a blog, where pages almost never change.
In that case, if the route is configured as static generated, Symfony won't even load, as the server serves the generate page directly (which implies a huge performance boost).
Similar implementations can be found in Tempest, Astro, and many other frameworks.
Here is an overview of the feature architecture:

StaticPageUrisProviderlists all Route marked as static, those can be defined as follows :staticGenerationconfiguration can be :routing.static_site.params_provider)There are some extension points :
StaticPageUrisProviderInterfaceto provide static page by another mean thansymfony/routing. A third party CMS system for example.ParamsProviderInterfaceto resolve params of dynamic routes. For example, with a route/blog/{slug}. We can create a param providers to list all slugs from a database, or all Markdown files in a directory.StaticPageDumperInterfaceto dump the pages content on another storage. Can be useful if we need to dump it to an S3 storage, to GitHub pages, ...