Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Framework Bundle Laravel Package

symfony/framework-bundle

FrameworkBundle integrates Symfony components into the full-stack Symfony framework, providing core wiring for services, configuration, routing, controllers, and more. Part of the main Symfony repository; see docs for contributing, issues, and PRs.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Core Framework Integration: The symfony/framework-bundle is the foundational glue between Symfony components (e.g., HTTP Kernel, Dependency Injection, Console, Validation) and the full-stack Symfony framework. It is mandatory for any Laravel-like application targeting Symfony’s ecosystem, as it provides:
    • Service container integration (autowiring, configuration, lifecycle management).
    • HTTP request/response lifecycle (routing, middleware, controllers).
    • Console command support (CLI tools, debugging, migrations).
    • Configuration management (YAML/XML/PHP config merging, environment variables).
    • Testing utilities (KernelTestCase, HTTP mocks, cache isolation).
  • Laravel Equivalents:
    • Replaces Laravel’s Service Provider, Container, and Routing layers.
    • Augments Laravel’s Artisan (Console) and Testing tools with Symfony’s maturity.
    • Provides dependency injection (vs. Laravel’s manual binding/tagging).
  • Key Differentiators:
    • Explicit over implicit: Symfony enforces configuration via config/packages/*, while Laravel uses config/app.php and service providers.
    • Attribute-based routing: Symfony 6+ supports [Route] attributes (like Laravel’s Route::get() but type-safe).
    • Event-driven architecture: Symfony’s EventDispatcher is more granular than Laravel’s Events facade.

Integration Feasibility

  • High for Symfony-native stacks: If migrating from Laravel to Symfony or building a new Symfony app, this bundle is non-negotiable.
  • Partial for Laravel hybrids:
    • Pros:
      • Can replace Laravel’s core (e.g., swap Illuminate\Foundation\Application with Symfony’s Kernel).
      • Enables Symfony’s DI container for complex service graphs (e.g., DDD, CQRS).
      • Adds first-class testing tools (e.g., KernelTestCase for HTTP tests).
    • Cons:
      • Breaking changes: Laravel’s Facade pattern clashes with Symfony’s PSR-11 container.
      • Configuration overhead: Symfony’s config/packages/ is verbose vs. Laravel’s config/.
      • Middleware stack: Symfony’s middleware key in config/packages/framework.yaml differs from Laravel’s Kernel.php.
  • Laravel-Specific Risks:
    • Blade vs. Twig: Symfony’s templating is Twig-based; Blade integration requires symfony/twig-bundle.
    • Eloquent ORM: Symfony’s Doctrine integration is deeper but requires doctrine/orm-bundle.
    • Queue system: Symfony’s Messenger component replaces Laravel Queues.

Technical Risk

Risk Area Severity Mitigation Strategy
Container Conflicts High Use symfony/dependency-injection to resolve Laravel’s Illuminate\Container.
Routing Duplication Medium Map Laravel routes to Symfony’s YamlConfigLoader or attribute routes.
Event System Medium Bridge Laravel’s Events to Symfony’s EventDispatcher via a listener.
Configuration Merge High Use Symfony’s Extension system to override Laravel’s config/.
Testing Overlap Low Prefer Symfony’s KernelTestCase for HTTP tests; keep Laravel’s HttpTests for legacy.
Middleware Order High Explicitly define middleware in config/packages/framework.yaml.
Service Provider → Extension High Convert Laravel providers to Symfony Extension classes.

Key Questions for TPM

  1. Is this a greenfield Symfony project or a Laravel migration?
    • Greenfield: Proceed with Symfony’s architecture.
    • Migration: Prioritize container compatibility, routing mapping, and testing parity.
  2. Will the team adopt Symfony’s DI container fully, or hybridize with Laravel?
    • Full adoption: Use symfony/framework-bundle as the sole container.
    • Hybrid: Isolate Laravel services in a sub-container (e.g., Laravel\Container as a Symfony service).
  3. How will templating (Blade/Twig) and ORM (Eloquent/Doctrine) coexist?
    • Blade: Use symfony/twig-bridge or a custom Blade compiler.
    • Doctrine: Requires doctrine/orm-bundle and entity mapping adjustments.
  4. What’s the CI/CD impact?
    • Symfony’s cache:warmup replaces Laravel’s config:cache.
    • Test suites may need dual phpunit.xml configs (Symfony’s KernelTestCase vs. Laravel’s TestCase).
  5. How will legacy Laravel middleware/services be ported?
    • Middleware: Convert to Symfony’s Middleware interface.
    • Services: Annotate with [Autowire] or register in services.yaml.
  6. Is the team comfortable with Symfony’s configuration system?
    • If not, consider a custom Extension to abstract Laravel-like config files.

Integration Approach

Stack Fit

  • Primary Use Case: Symfony Full-Stack Applications (replaces Laravel’s core).
  • Secondary Use Case: Laravel-Symfony Hybrid Apps (e.g., migrating incrementally).
  • Tech Stack Compatibility:
    Component Symfony Bundle Equivalent Integration Notes
    Laravel Container symfony/dependency-injection Use FrameworkBundle’s autowiring.
    Laravel Routing symfony/http-kernel + routing Map Route::get() to [Route] attributes.
    Laravel Middleware framework.yaml middleware stack Convert app/Http/Kernel.php to config.
    Laravel Service Providers Extension classes Extend AbstractExtension for config.
    Laravel Events symfony/event-dispatcher Bridge via a listener service.
    Laravel Blade symfony/twig-bundle Use TwigBridge or custom compiler.
    Laravel Eloquent doctrine/orm-bundle Requires entity mapping adjustments.
    Laravel Queues symfony/messenger Replace Queue workers with Messenger.
    Laravel Artisan symfony/console Use Command classes with FrameworkBundle.

Migration Path

  1. Phase 1: Dependency Injection
    • Replace Laravel’s ServiceProvider with Symfony Extension.
    • Convert bind()/singleton() to services.yaml or autowiring.
    • Example:
      // Laravel (old)
      $this->app->singleton(MyService::class, function () {
          return new MyService();
      });
      
      // Symfony (new)
      // services.yaml
      My\Service\MyService: ~
      
  2. Phase 2: Routing & Controllers
    • Replace Route::get() with [Route] attributes or YAML routes.
    • Convert RouteServiceProvider to Symfony’s routing config.
    • Example:
      // Laravel (old)
      Route::get('/hello', [Controller::class, 'hello']);
      
      // Symfony (new)
      #[Route('/hello', name: 'hello')]
      public function hello(): Response { ... }
      
  3. Phase 3: Middleware & Kernel
    • Migrate app/Http/Kernel.php to config/packages/framework.yaml.
    • Example:
      # framework.yaml
      middleware: ['framework.http_cache', 'framework.trusted_proxies']
      
  4. Phase 4: Testing
    • Replace phpunit.xml with Symfony’s KernelTestCase.
    • Example:
      class MyTest extends KernelTestCase {
          public function testHomepage() {
              $client = static::createClient();
              $client->request('GET', '/');
              $this->assertResponseStatusCodeSame(200);
          }
      }
      
  5. Phase 5: Templating & ORM
    • Swap Blade for Twig (symfony/twig-bundle).
    • Migrate Eloquent models to Doctrine entities.

Compatibility

  • Pros:
    • PSR-11/PSR-15 compliance: Symfony’s container and middleware are standards-based.
    • Modern PHP features: Supports attributes, enums, and typed properties.
    • Testing tools: KernelTestCase is superior to Laravel’s for HTTP scenarios.
  • Cons:
    • Configuration verbosity: Symfony’s config/packages/ is more explicit than Laravel’s config/.
    • Learning curve: Symfony’s DI and event systems require re-education.
    • Tooling differences: Use symfony/console instead of Artisan for CLI tasks.

Sequencing

  1. Start with non-critical services (e.g.,
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport