Symfony Flex was introduced in 2017 as one of the key parts of the reimagined Symfony experience for the Symfony 4 launch. Symfony Flex is a tool (technically, a Composer plugin) that simplifies the installation/removal of packages in Symfony applications.
This simplification is made possible thanks to "Flex recipes", which are a set of automated instructions that tell Symfony how to install, enable and configure packages into applications. These recipes are currently stored in two public GitHub repositories: main recipes repository and contrib recipes repository.
The final piece that makes Flex possible is the Flex server at https://flex.symfony.com
.
In addition to showing the available recipes/packages in a web interface, this
server communicates with the Flex Composer plugin to serve recipes.
Going Serverless
As part of our continuous efforts to simplify operations, we recently asked ourselves: how could we simplify the Flex server infrastructure? Then we thought: what if we remove the Flex server entirely? And that's exactly what we're going to do.
In the pull request #803 of the Symfony Flex package you can see that we're
going to replace the proprietary flex.symfony.com
endpoint by a new endpoint
made of static JSON files hosted on GitHub.
The JSON files are stored in this repository and are generated by GitHub Actions using this script thanks to a custom recipe checker tool. The existing Flex server endpoint will keep working for some time as a legacy service for applications that haven't been updated yet.
Using the New Endpoints
Version 1.16 of symfony/flex
has been released with support for the new
endpoints, but they are behind a feature flag for now: you need to set the
FLEX_SERVERLESS
env var to 1
to enable the new endpoints.
Please help us confirm that everything works as expected by enabling this feature flag.
In a few weeks, version 1.17 will remove the feature flag and the new
endpoints will be used by default. All users of legacy versions of
symfony/flex
will then see a warning inviting them to upgrade.
Custom Recipes
A very nice side effect of this change is that you can quite easily host custom
recipes in your own repositories. If you do so, add the URL of your recipe
repository in the extra.symfony.endpoint
config option of composer.json
or in the SYMFONY_ENDPOINT
env var.
Moreover, now that the proprietary server is gone, you can add your own features on top of the Symfony Flex API. We're looking forward to learn about your ideas. Some of them could even be contributed back to the official Flex API.
You had me at “host recipes inside your own repos” 😁
I've been waiting for easier custom recipes ever since Flex came out ! Thanks a lot !
Would be great if sections (paragraphs) had their own IDs so linking to specific part of the article could be possible. I wanted to point my team to "Custom Recipes" part but I can't unfortunately.
Anyway, great change!
Grzegorz, nice idea! We've just updated the blog post with clickable/linkable sections. Thanks!
To be clear, are bundles now able to point to their own recipe, or the projects utilizing them can point to recipes? And is/will there be documentation on this? Reading through the code, this blog post, and the PR, trying to figure out the appropriate syntax and whatnot has not been overly helpful to me (yet).
Sounds good!!!
But if I may ask a stupid question - why couldn't this json file just be in the project root? I think the problem of verisioning would then be solved automatically and the whole witch's dance about where all the recipes go is also done!
Is it really necessary to keep these recipes outside of the actual projects? Am I missing something?
@Richard @Michael putting recipes in the packages themselves is not something that makes sense to us. I put some of the reasoning in https://github.com/symfony/flex/pull/753#issuecomment-924109963 if you want to have a look.
@Nicolas, thanks for the update ! I just setup a recipe server for my company private bundle.