This guide covers advanced scenarios for using make-bundle.
Force interactive configuration even when providing arguments:
bin/console make:bundle acme/my-bundle lib --interactive
# or
bin/console make:bundle acme/my-bundle lib -iWhen providing vendor-package and target-folder, the bundle uses defaults:
bin/console make:bundle acme/my-bundle libDefault configuration:
- Symfony 6.4 LTS
- Unit and integration test structure
- Documentation structure included
- No optional features (services, commands, controllers, etc.)
Add the bundle as a local repository in your project's composer.json:
{
"repositories": [
{
"type": "path",
"url": "./lib/acme/my-bundle"
}
]
}composer require acme/my-bundle @devThe @dev version allows Composer to use your local development version.
Symfony Flex usually auto-registers bundles, but if not:
// config/bundles.php
return [
// ...
Acme\MyBundle\AcmeMyBundleBundle::class => ['all' => true],
];composer remove acme/my-bundleWhen using interactive mode, you can select:
Dependencies:
- Symfony Console (for commands)
- Twig Bundle (for Twig extensions)
- Asset Component (for asset management)
- Security Bundle (for security features)
- Doctrine Bundle (for ORM integration)
- Messenger (for message handling)
- Validator (for data validation)
- Serializer (for data serialization)
- HTTP Client (for HTTP requests)
- Mailer (for email sending)
Features:
- Compiler passes
- Event subscribers
- Twig functions/filters
- Custom form types
- Custom validators
Components:
- Services
- Console commands
- Controllers
- Twig extensions
Testing:
- Unit tests
- Integration tests
- Functional tests
The command tries to auto-discover your vendor name from:
- Existing vendor directories (
vendor/,lib/,packages/, etc.) - composer.json in current directory
- Git configuration (
git config user.name) - System username
- Random generation (fallback)
Create config/make_bundle.yaml in your project:
vendor_discovery:
vendor_directories:
- vendor
- lib
- packages
- bundles
excluded_directories:
- node_modules
- .git
- var
- tmp
preferred_vendors:
- acme
- my-vendor
package_generation:
prefixes:
- bundle
- component
- library
adjectives:
- awesome
- cool
- smart
nouns:
- utils
- helpers
- toolsYou can create multiple bundles under the same vendor:
bin/console make:bundle acme/utils lib
bin/console make:bundle acme/helpers lib
bin/console make:bundle acme/widgets libStructure:
lib/
├── acme/
│ ├── utils/
│ ├── helpers/
│ └── widgets/
Each bundle can be required separately:
composer require acme/utils @dev
composer require acme/helpers @dev# All bundles in lib/
bin/console make:bundle acme/bundle-one lib
bin/console make:bundle acme/bundle-two lib
bin/console make:bundle acme/bundle-three lib# Different vendors in different folders
bin/console make:bundle acme/bundle lib
bin/console make:bundle vendor-two/bundle packages# Each bundle in its own top-level folder
bin/console make:bundle acme/bundle-one repos
bin/console make:bundle acme/bundle-two reposOverride the template directory in your project:
# config/packages/make_bundle.yaml
parameters:
neuralglitch_make_bundle.template_dir: '%kernel.project_dir%/my-templates'- Copy templates from
vendor/neuralglitch/make-bundle/templates/ - Modify as needed
- Configure custom template directory
- Generate bundles with your templates
See templates.md for template customization guide.
Problem: Command succeeds but no bundle directory
Solutions:
- Check target folder exists and is writable
- Verify vendor/package name format (
vendor/package) - Check for permission errors
Problem: Invalid vendor/package format
Solution: Use lowercase letters and dashes only:
- ✅
acme/awesome-utils - ❌
Acme/AwesomeUtils - ❌
acme_corp/awesome_utils
Problem: composer require can't find your bundle
Solution: Add path repository to composer.json:
{
"repositories": [
{
"type": "path",
"url": "./lib/vendor/package"
}
]
}Problem: Bundle has attributes but project uses Symfony 6.4
Solution:
- Regenerate bundle with correct Symfony version
- Or manually convert attributes to annotations
See symfony-versions.md for version migration guide.
bin/console make:bundle acme/minimal lib
# Accept all defaultsResult: Basic bundle with annotations, no optional features.
bin/console make:bundle acme/full-bundle lib --interactiveThen select:
- Symfony 7.1 LTS
- Services: Yes
- Commands: Yes
- Controllers: Yes
- Twig Extensions: Yes
- All test types
Result: Complete bundle with all features and attributes.
bin/console make:bundle acme/api-client lib --interactiveSelect:
- Services: Yes (for API client service)
- HTTP Client dependency
- Unit + Integration tests
bin/console make:bundle acme/custom-forms lib --interactiveSelect:
- Form types feature
- Twig extensions (for form rendering)
- Validators (for form validation)
After generating a bundle:
- Read the generated README.md in the bundle directory
- Install dependencies:
cd lib/vendor/package && composer install - Add your code to the generated structure
- Write tests in
tests/Unit/andtests/Integration/ - Configure your bundle in
src/DependencyInjection/Configuration.php - Add services to
src/Resources/config/services.yaml
- Usage Guide - Basic usage and examples
- Symfony Versions - Version-specific features
- Templates - Customizing templates