yceruto/bundle-flex
A Symfony bundle that brings Flex-style automation to bundle setup, simplifying installation, service registration, and configuration with sensible defaults so third-party bundles integrate faster with less boilerplate.
yceruto/bundle-flex is a Composer plugin that closes the gap Symfony Flex leaves for third-party bundles: when you composer require a bundle that has no Flex recipe, this plugin registers it in your project's config/bundles.php automatically, and removes the entry when you composer remove it. Think of it as "bundle registration as a side effect of dependency management."
Minimal steps:
config/bundles.php), and PHP version compatible with the plugin's composer.json.composer require --dev yceruto/bundle-flex
config.allow-plugins in composer.json.composer require acme/some-bundle
git diff config/bundles.php
If the plugin recognized the package as a Symfony bundle, you'll see a new Acme\SomeBundle\AcmeSomeBundle::class => ['all' => true] entry.Where to look first:
config/bundles.php — the file the plugin mutates; this is your source of truth and should always be committed.vendor/yceruto/bundle-flex/src/ — the plugin is small; read the event subscribers to see exactly which Composer events it hooks (post-package-install, post-package-update, post-package-uninstall or similar) and how it decides a package is a bundle (typically type: symfony-bundle and/or extra metadata).composer.json — check its type and extra keys; that's what makes it "visible" to the plugin.composer.lock — after a require, confirm the plugin version is pinned.Given the package's age, low star count, and unknown repository status, treat step 2 as an evaluation step: run it in a scratch branch, inspect the diff, and only then adopt it in a shared codebase.
The core workflow — require, review, commit. The plugin's value is purely at dependency-management time, so the natural pattern is:
git checkout -b add-some-bundle
composer require acme/some-bundle
git diff config/bundles.php # inspect what the plugin wrote
bin/console cache:clear
git commit -am "Add acme/some-bundle"
Never let the plugin's write be invisible. It edits a committed PHP file, so it belongs in code review like any other change.
For bundle authors. If you maintain a bundle and want it to be picked up, declare it as a bundle in composer.json ("type": "symfony-bundle" plus, if the plugin requires it, an extra entry naming the bundle class). Verify by requiring it into a throwaway Symfony app with the plugin installed and checking that config/bundles.php updates and bin/console boots.
Coexistence with Symfony Flex. Flex handles symfony/* and recipe-bearing packages; this plugin handles the long tail. Keep them separate in your mental model: if a recipe exists, Flex wins and the plugin should have nothing to do. If both ever try to manage the same entry, that's a bug — see Gotchas.
CI and container builds. Because the plugin runs on composer install, it will re-add entries on a clean checkout if config/bundles.php is missing or was reset. Keep config/bundles.php committed so CI and production images use the committed state rather than relying on plugin execution. If you do want install-time registration in CI, ensure allow-plugins is pre-configured so composer install --no-interaction doesn't fail on the prompt:
{
"config": {
"allow-plugins": {
"yceruto/bundle-flex": true
}
}
}
Environment awareness. Auto-registration typically appends ['all' => true]. That's fine for libraries like a mailer or an imaging bundle, but for bundles that must only load in dev (debug toolbars, fixtures, profilers) or only in prod, edit the entry by hand afterwards. Don't expect the plugin to infer environments.
Multi-app / monorepo. Plugins operate on the root package, so in a repo with several Symfony apps the plugin edits the root app's config/bundles.php. It is not a substitute for a proper monorepo dependency strategy; avoid requiring bundles at the workspace root if only one app needs them.
Companion to an internal recipe repository. If your organization runs a private Flex endpoint, prefer recipes. Reach for this plugin for the bundles you don't control or that haven't been reciped — it's the lowest-friction option for "third-party bundle, no recipe, don't want to hand-edit bundles.php."
allow-plugins is mandatory. Interactive installs prompt; non-interactive installs fail or silently skip the plugin. Always add the allow-list entry to composer.json and commit it, and test a fresh composer install --no-interaction in CI.require-dev and production runs composer install --no-dev, the plugin isn't there to register anything. That's fine only because you commit config/bundles.php. Never rely on production installs to generate bundle registrations.composer dump-autoload and bin/console cache:clear, then re-check the class name in the package's composer.json.config/bundles.php must exist and be writable. A missing file, a read-only checkout, or an unusual format (trailing content, multiple arrays) can break the rewrite. The plugin is not a general PHP rewriter; it expects the standard Flex-generated structure.composer require -vvv acme/some-bundle to see plugin events fire. If nothing happens, the package likely lacks type: symfony-bundle or the expected extra flag — inspect its composer.json and compare to a bundle that did get registered. composer diagnose catches plugin/allow-list misconfiguration.git checkout -- config/bundles.php and register manually. Treat the plugin as an accelerator, never as the only record of what your app loads.dev, or write a different file), the practical route is forking and modifying the event subscriber, not configuring it — expect little to no configuration surface in a package this small.make target that edits config/bundles.php, or simply manual registration. If your dependency churn is low, the manual option costs less than an unmaintained plugin.How can I help you explore Laravel packages today?