Reference / Symfony
/

Bundles

Reusable, distributable plugins. Your app itself is a bundle in older Symfony; modern apps usually have just framework-provided bundles.

Intermediate
  • Each bundle exposes services, config, routes, templates, and translations.
  • Registered in `config/bundles.php` per environment (`["all" => true]`, `["dev" => true]`, etc.).
  • The bundle class can extend `AbstractBundle` (Symfony 6.1+) for simpler config wiring than the old DI extension pattern.
  • Common third-party bundles: DoctrineBundle, SecurityBundle, MakerBundle, EasyAdminBundle, MonologBundle.
  • Avoid building your own bundle for one-off code — services in `src/` are usually enough.

Common gotchas

  • Composer-installed bundles need their recipe applied (or you add them manually to `bundles.php` and copy default config).
  • Bundle config goes in `config/packages/<bundle_name>.yaml` and is environment-aware via subfolders.