dktaylor/bundle-generator-bundle
Installation
Run composer require dktaylor/bundle-generator-bundle in your Symfony project root.
Ensure config/bundles.php includes the bundle (auto-registered via Flex if present).
First Use Case Generate a new bundle skeleton:
php bin/console make:bundle MyVendor/MyBundle
This creates a standalone bundle in ../MyVendor/MyBundle (one level up) and symlinks it to lib/MyVendor/MyBundle.
Where to Look First
php bin/console list → Filter for make:bundle and related commands.config/packages/dktaylor_bundle_generator.yaml (if any).vendor/dktaylor/bundle-generator-bundle/Resources/skeleton.Bundle Development Loop
make:bundle MyVendor/MyBundle../MyVendor/MyBundle, symlink updates auto-propagate.make:test (if configured) or manually load the bundle in Symfony’s kernel.Custom Templates
Override defaults by copying vendor/dktaylor/bundle-generator-bundle/Resources/skeleton to config/bundles/skeleton/ and extending the base class:
# config/packages/dktaylor_bundle_generator.yaml
dktaylor_bundle_generator:
skeleton_dir: '%kernel.project_dir%/config/bundles/skeleton'
Integration with Symfony Flex
config/bundles.php after generation.make:bundle --recipe=my-recipe).Multi-Bundle Projects
Use --path to generate bundles in arbitrary locations:
make:bundle MyVendor/MyBundle --path=~/Projects/bundles
composer dump-autoload after symlinking to refresh autoloading.find lib -type l -exec test -e {} \; || exit 1
make:bundle --with-services to auto-generate DI configurations.Symlink Issues
ls -l lib/.composer dump-autoload --optimize to force a refresh.Namespace Collisions
Vendor/Bundle when Vendor already exists in vendor/ (not lib/).lib/ for local bundles or use unique vendor names (e.g., MyCompany/).Template Overrides
skeleton_dir in config points to a valid directory with a Bundle class extending BaseBundle.Flex Auto-Configuration
bundles.php.config/bundles.php or run composer dump-autoload.--verbose:
make:bundle MyVendor/MyBundle --verbose
php bin/console debug:container | grep MyBundle
APP_ENV=dev) and check var/log/dev.log.Custom Commands
Extend the generator with new commands by creating a Command class in your bundle and tagging it:
services:
MyVendor\MyBundle\Command\MyCommand:
tags: ['console.command']
Event Subscribers Hook into bundle generation events (if the package supports them) via:
use DKTaylor\BundleGeneratorBundle\Event\BundleGenerateEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class MySubscriber implements EventSubscriberInterface {
public static function getSubscribedEvents() {
return [
BundleGenerateEvent::NAME => 'onBundleGenerate',
];
}
}
Post-Generation Scripts
Add a post-generate script in composer.json to run custom tasks:
"scripts": {
"post-autoload-dump": [
"@post-generate",
"symlink-bundles"
],
"post-generate": [
"php bin/console my:post-bundle-setup"
]
}
skeleton_dir in config.composer.json has "extra": { "symfony": { "allow-contrib": true } }.bundles.php (e.g., MyVendor/MyBundle ≠ myvendor/mybundle).How can I help you explore Laravel packages today?