danielm/symfony-demo-bundle
Demo Symfony bundle showing common bundle features: console command, services/contracts, events/subscriber, Twig extension, controllers with JSON/HTML routes, config with env vars, translations and public assets. Useful as a Symfony Flex recipe/demo reference.
EventDispatcher with Laravel’s, Twig with Blade, or console commands with Laravel’s Artisan commands).Bundle class to a Laravel Service Provider).config/ can map to Laravel’s config/ with minor adjustments.Illuminate\Events.Command with Laravel’s Artisan commands.DemoTwigExtension would need conversion to a Blade directive or helper function.symfony/console → Laravel’s Illuminate/Console, symfony/event-dispatcher → Illuminate/Events).phpunit + laravel/testcase).Bundle class or Twig logic without refactoring.EventDispatcher differs from Laravel’s; custom event classes would need rewriting.Annotation-based routing (@Route) vs. Laravel’s Route::get() requires manual mapping.SymfonyEventDispatcherAdapter for Laravel).FrameworkAdapter trait).ContainerInterface with Laravel’s Illuminate/Container.Illuminate\Support\Facades\Event instead of Symfony’s EventDispatcher.@Route annotations to Laravel’s Route::get() in a Service Provider.Symfony\Component\Console\Command with Illuminate\Console\Command.Str::demoFcn() helper.| Symfony Component | Laravel Equivalent |
|---|---|
symfony/event-dispatcher |
Illuminate/Events |
symfony/console |
Illuminate/Console |
twig/twig |
Blade or custom view layer |
symfony/dependency-injection |
Laravel’s container |
DemoServiceInterface) and DTOs into a standalone PHP library (Composer package).// Before (Symfony-specific)
class DemoService implements DemoServiceInterface {
public function __construct(private EventDispatcherInterface $dispatcher) {}
}
// After (Laravel-compatible)
class DemoService implements DemoServiceInterface {
public function __construct(private Dispatcher $dispatcher) {} // Laravel's Event::dispatch()
}
DemoServiceProvider) to:
Route::get('/{a}/{b}', [DemoController::class, 'add'])).config/demo.php).DemoTwigExtension with a Blade directive or helper:
// Blade directive (register in ServiceProvider)
Blade::directive('demoFcn', function () { ... });
TestCase.artisan demo:command.Event::dispatch().config/packages/demo.yaml → Laravel’s config/demo.php.use Symfony\Component\HttpFoundation\Response → use Illuminate\Http\Response).EventDispatcherInterface methods").UPGRADING.md.ExceptionListener → Laravel’s App\Exceptions\Handler.| Risk | Impact | Mitigation |
|---|---|---|
| Framework-Specific Bugs | Breaks Laravel integration | Unit test adapters in isolation. |
| Twig → Blade Conversion | Template rendering fails | Start with a helper function instead of directives. |
| Event System Mismatch | Events not dispatched | Write a wrapper class for EventDispatcher. |
| Configuration Merge Conflicts | config/demo.php overrides fail |
Use Laravel’s mergeConfigFrom. |
Bundle.EventDispatcherInterface in Laravel).How can I help you explore Laravel packages today?