Symfony Flex

The Composer plugin that automates recipe installation and scaffolding for Symfony apps.

Tool
Composer
vv2.11.0
4,212stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
68/100Good
Development Activity44
Maintenance60
Community68
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture78
Code Quality80
Innovation82
Learning Curve72

Symfony Flex is a Composer plugin that turns composer require into an automated project-scaffolding tool for Symfony applications. When a package with a published “recipe” is required, Flex fetches that recipe from the community Symfony Recipes repository and applies it automatically — writing config files, registering bundles, updating .env, and adding Docker/CI boilerplate — instead of leaving developers to wire everything by hand.

It underpins the modern Symfony developer experience: new Symfony projects start from a minimal skeleton, and functionality is added incrementally by requiring packages, with Flex keeping the generated configuration in sync as dependencies change or are removed.

What You Get

  • Automatic recipe application on composer require/composer remove, wiring config, bundles, and .env entries
  • A symfony new / skeleton-based project bootstrap flow for starting new Symfony apps
  • .env file management, merging environment variables contributed by each installed package’s recipe
  • Unpacking of “pack” meta-packages into their real, pinned dependency set
  • Console commands for recipe status inspection (symfony:recipes, symfony:recipes:install, symfony:recipes:update)
  • Docker and CI scaffolding contributed by recipes for common services (databases, message brokers)

Common Use Cases

  • Starting a new Symfony project via the skeleton and letting Flex assemble the initial configuration
  • Adding a new capability (e.g. symfony/mailer, doctrine/orm) and getting its config, .env vars, and bundle registration applied automatically
  • Auditing which recipes are outdated or were modified locally via symfony:recipes
  • Removing a package cleanly, with Flex reverting the config it originally added
  • Standardizing project setup across a team so every developer’s local .env/config matches what recipes define

Under The Hood

Architecture Flex’s entry point is src/Flex.php, a Composer plugin class that hooks into Composer’s event system (package install/update/uninstall events) to trigger recipe resolution. PackageResolver.php and Downloader.php fetch recipe metadata and payloads from the Symfony Recipes repositories, Configurator.php and the Configurator/ subdirectory apply the recipe’s file operations (copy files, merge config, register bundles, append env vars), and Unpacker.php/Unpack/ handles expanding meta-packages into concrete dependencies. Lock.php tracks which recipes/versions are applied so updates and removals can be reverted precisely. Tech Stack Built against composer-plugin-api ^2.1, requiring PHP 8.1+; dev dependencies include composer/composer itself for plugin-API integration testing and symfony/dotenv/symfony/filesystem/symfony/process for the .env and filesystem operations recipes perform. Code Quality tests/ mirrors the src/ structure with unit tests per configurator, downloader, and unpacker class; as a core Symfony org project it follows the same CI, coding-standards, and semver/BC policy as the rest of the framework, with 118 contributors. API Design End users interact with Flex almost entirely through existing Composer commands (composer require, composer remove) plus a handful of symfony:recipes:* console commands — there’s essentially no new API surface to learn, which is the point: Flex’s design goal is to make advanced scaffolding invisible during normal Composer usage.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search