Weave 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 Extra Bundle Laravel Package

draw/framework-extra-bundle

Symfony bundle that integrates draw/* components with configuration under the draw_framework_extra namespace. Some features auto-enable when components are present; others are opt-in to avoid unnecessary load or side effects. Includes Application and OpenAPI integrations.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Symfony Integration: The bundle is designed specifically for Symfony, leveraging its dependency injection, configuration system, and event system. This aligns well with Laravel’s ecosystem if adapted via Symfony Bridge (e.g., spatie/symfony-bundle) or a custom wrapper.
  • OpenAPI Focus: The OpenAPI integration (annotations, schema generation, and serialization) is a strong fit for Laravel’s API-first projects, where tools like NWBot/OpenAPI or darkaonline/l5-swagger are already used. The bundle’s annotation-driven approach mirrors Laravel’s attribute-based routing (PHP 8+).
  • Modularity: The bundle’s optional feature flags (e.g., enableDoctrineSupport) suggest a modular design, which can be replicated in Laravel via service providers and optional configurations.

Integration Feasibility

  • PHP 8+ Compatibility: The bundle uses attributes (#[OpenApi\Tag]), which are natively supported in Laravel 9+. Backward compatibility with older Laravel versions would require polyfills (e.g., ramsey/uuid for PHP 7.4).
  • Symfony Dependencies: Heavy reliance on Symfony components (e.g., FrameworkExtraBundle, EventDispatcher) requires abstraction or replacement. For example:
    • Replace EventDispatcher with Laravel’s Events system.
    • Replace FrameworkExtraBundle configurations with Laravel’s Route::attributes() or middleware.
  • Doctrine ORM: The enableDoctrineSupport flag implies Doctrine integration, which is optional in Laravel (Eloquent is the default). A custom Doctrine-to-Eloquent mapper would be needed for schema generation.

Technical Risk

  • High Customization Effort: Replicating Symfony’s event system (e.g., KernelEvents::VIEW) in Laravel would require significant refactoring. The VersionListener example highlights this risk.
  • Annotation vs. Attributes: Laravel’s shift from annotations (use Sensio\Bundle\FrameworkExtraBundle\Configuration\...) to attributes (#[Route]) may require rewriting annotation parsers (e.g., using phpdocumentor/reflection-docblock).
  • OpenAPI Generation: The bundle’s OpenAPI schema generation relies on Symfony’s templating and serialization systems. Laravel’s spatie/laravel-openapi or darkaonline/l5-swagger would need to be extended or replaced.
  • Sandbox Dependency: The draw:open-api:install-sandbox command introduces a runtime dependency on external versions (e.g., v3.52.5), which could complicate CI/CD pipelines.

Key Questions

  1. Use Case Alignment:
    • Is the primary goal OpenAPI documentation (like l5-swagger) or API response serialization (like spatie/laravel-fractal)?
    • Does the team need Symfony’s event-driven architecture, or can Laravel’s events/middleware suffice?
  2. Dependency Trade-offs:
    • Are you willing to abstract Symfony dependencies (e.g., replace EventDispatcher with Laravel’s Events)?
    • How will Doctrine integration (if needed) map to Eloquent or a custom ORM?
  3. Maturity and Maintenance:
    • The bundle is WIP with no stars/dependents. Is the maintainer (mpoiriert) active? Are there alternatives (e.g., zircote/swagger-php)?
    • How will configuration drift (e.g., YAML vs. Laravel’s .env or config/) be managed?
  4. Performance Impact:
    • The bundle’s schema generation and runtime annotations may add overhead. How does this compare to Laravel’s native solutions?
  5. Long-Term Viability:
    • If this is a greenfield project, is it better to invest in a mature Laravel package (e.g., spatie/laravel-openapi) or build a custom wrapper?

Integration Approach

Stack Fit

  • Laravel Compatibility:
    • Attributes: Replace Symfony annotations with Laravel attributes (e.g., #[OpenApi\Tag] → custom #[ApiTag]).
    • Routing: Use Laravel’s Route::attributes() or middleware to replicate FrameworkExtraBundle functionality.
    • Events: Map Symfony’s EventDispatcher to Laravel’s Events system (e.g., KernelEvents::VIEW → events:view).
    • Configuration: Migrate YAML configs to Laravel’s config/draw.php with .env overrides.
  • OpenAPI Tools:
    • Leverage existing Laravel packages:
      • Documentation: darkaonline/l5-swagger or spatie/laravel-openapi.
      • Serialization: spatie/laravel-fractal or nesbot/carbon for responses.
    • The bundle’s Schema and Serialization annotations could be adapted into Laravel’s OpenApi\Attributes (PHP 8+).

Migration Path

  1. Phase 1: Proof of Concept
    • Create a minimal Laravel wrapper for the bundle’s core features (e.g., OpenAPI annotations).
    • Test with a single controller to validate attribute parsing and schema generation.
  2. Phase 2: Dependency Abstraction
    • Replace Symfony-specific components:
      • EventDispatcher → Laravel Events.
      • FrameworkExtraBundle → Custom middleware/route attributes.
      • Doctrine → Eloquent or a custom mapper.
  3. Phase 3: Full Integration
    • Implement the draw:open-api:install-sandbox equivalent (e.g., a Composer script or Artisan command).
    • Add Laravel-specific features (e.g., .env-based configuration, Blade templating for docs).
  4. Phase 4: Optimization
    • Benchmark performance against native Laravel solutions (e.g., l5-swagger).
    • Refactor for Laravel’s caching system (e.g., config_cache, route_model_binding).

Compatibility

  • Laravel 9+: Full compatibility due to PHP 8+ attributes and Symfony 6+ alignment.
  • Laravel 8: Possible with polyfills for attributes (e.g., laravel-shift/doctrine-attributes).
  • Symfony Components: Use symfony/console, symfony/event-dispatcher, and symfony/dependency-injection via Composer, but expect friction in event handling.
  • OpenAPI Spec: The bundle’s OpenAPI v2 focus may conflict with Laravel’s shift to OpenAPI v3 (e.g., zircote/swagger-php supports v3).

Sequencing

  1. Core Features First:
    • Prioritize OpenAPI annotation parsing and schema generation.
    • Delay Doctrine/Eloquent integration until Phase 2.
  2. Configuration Last:
    • Start with hardcoded defaults, then migrate to config/draw.php.
  3. Commands/Artisan:
    • Implement draw:open-api:install-sandbox as a custom Artisan command (e.g., draw:install).
  4. Testing:
    • Use PestPHP or PHPUnit to validate attribute parsing and event dispatching.
    • Test with a real API endpoint to ensure OpenAPI docs generate correctly.

Operational Impact

Maintenance

  • Dependency Management:
    • The bundle’s reliance on Symfony components increases maintenance overhead. Example:
      • Updating symfony/event-dispatcher may break Laravel’s event system.
      • Solution: Pin versions strictly or use Laravel’s native alternatives.
    • Sandbox Dependency: The install-sandbox command introduces versioning risks. Consider:
      • Moving to Composer-managed dependencies (e.g., require-dev).
      • Replacing with a Laravel package like spatie/laravel-package-tools.
  • Configuration Drift:
    • YAML configs in Symfony vs. PHP/ENV in Laravel require a migration strategy. Use:
      • spatie/laravel-config-array to merge YAML into Laravel’s config.
      • .env overrides for sensitive settings (e.g., DRAW_OPEN_API_ENABLE_DOCTRINE=true).

Support

  • Debugging Complexity:
    • Symfony’s event system is less intuitive in Laravel. Mitigate with:
      • Clear documentation for event listeners (e.g., VersionListener equivalent).
      • Logging (e.g., Log::debug('OpenAPI event triggered')) to trace execution.
    • Annotation Parsing: Laravel’s attribute reflection may behave differently. Test edge cases (e.g., nested attributes, inheritance).
  • Community Resources:
    • Limited adoption (0 stars) means minimal community support. Plan for:
      • Internal documentation for custom implementations.
      • Contributing fixes back to the original repo (if open to collaboration).

Scaling

  • Performance:
    • Annotation Parsing: Runtime reflection (e.g., #[OpenApi\Tag]) can slow boot time. Optimize with:
      • Compiled route caching (Laravel’s route:cache).
      • Pre-parsing annotations during bootstrap/app.php.
    • Schema Generation: Generating OpenAPI docs on-demand may impact API response times. Offload to:
      • A background job (e.g., spatie/laravel-queueable-scheduled-jobs).
      • A separate service (e.g., meilisearch for API docs).
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.
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus