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

Dashboard2 Bundle Laravel Package

2lenet/dashboard2-bundle

A Symfony bundle for building customizable dashboards with widgets. Generate widgets via maker, control visibility with roles, configure caching and Twig templates, and store widget data with Doctrine migrations. Includes setup and troubleshooting recipes.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Modularity: The bundle follows a widget-based architecture, aligning well with modern Laravel/Symfony dashboard patterns (e.g., Symfony UX, Livewire). Widgets are self-contained (logic + templating) and can be composed into dashboards, making it ideal for feature-rich admin panels or analytical dashboards.
  • Separation of Concerns:
    • Presentation: Templating via Twig (Bootstrap 5 cards).
    • Business Logic: Widgets extend AbstractWidget with render(), getName(), and supports() methods.
    • Data: Supports caching (5-minute TTL by default) and configuration via JSON-stored config fields.
  • Extensibility:
    • Custom Widgets: Maker commands (make:widget, make:workflow-widget) accelerate development.
    • Static Dashboards: Predefined layouts via StaticWidgetProviderInterface, useful for read-only or marketing dashboards.
    • Chart Integration: Leverages Symfony UX Chartjs for dynamic visualizations (bar charts, line graphs, etc.).
  • Security: Role-based widget access (supports() method) integrates with Symfony’s security system ($this->security->getUser()).

Integration Feasibility

  • Laravel Compatibility:
    • Symfony Bundle: Requires Symfony components (e.g., security, form, twig). In Laravel, this would need Symfony’s HTTP Kernel or a bridge (e.g., spatie/laravel-symfony-support).
    • Routing: Uses Symfony’s routes.yaml; Laravel’s routes/web.php would need adaptation (e.g., via RouteServiceProvider).
    • Dependency Injection: Laravel’s container is not fully compatible with Symfony’s autowiring. Manual binding or a container adapter (e.g., symfony/dependency-injection) would be required.
  • Database Schema:
    • Requires a widgets table (migration provided). Laravel’s migration system can handle this, but Doctrine ORM (Symfony’s default) would need Elquent integration or a hybrid approach.
  • Frontend:
    • Bootstrap 5: Works with Laravel Mix/Vite or Symfony Encore.
    • Twig: Laravel’s Blade templating would need a Twig bridge (e.g., twig/bridge) or inline Twig rendering (less performant).

Technical Risk

Risk Area Description Mitigation Strategy
Symfony Dependency Laravel’s ecosystem is optimized for Laravel, not Symfony bundles. Use Symfony’s HTTP Kernel in a subdirectory or adopt a micro-framework (e.g., Symfony Standalone).
ORM Incompatibility Doctrine ORM vs. Eloquent. Widgets may rely on Doctrine features (e.g., QueryBuilder). Abstract data access layer (DAL) or use Eloquent Doctrine Bridge (e.g., laravel-doctrine/orm).
Caching Complexity Widget caching uses Symfony’s cache system. Laravel’s cache drivers (Redis, file) may not align. Implement a cache adapter (e.g., symfony/cache with Laravel’s cache store).
Static Dashboard Requires custom StaticWidgetProvider. Laravel’s service providers would need to register the provider and tag widgets (Symfony’s autoconfiguration feature). Use Laravel’s tagging system (e.g., bindTagged()) or manually register widgets in a service provider.
Chartjs Dependency Relies on Symfony UX Chartjs. Laravel’s charting libraries (e.g., chartjs/chart.js) may not be directly compatible. Use Symfony UX Chartjs in a standalone mode or replace with a Laravel-compatible charting library (e.g., laravel-chartjs).
Performance Widget caching (5-minute TTL) may not suit real-time dashboards. Override getCacheTimeout() or disable caching (return 0) for dynamic widgets.

Key Questions

  1. Symfony vs. Laravel Trade-offs:
    • Is the team comfortable with Symfony components (e.g., security, forms, caching) in a Laravel app?
    • Would a hybrid architecture (e.g., Symfony for dashboards, Laravel for APIs) be viable?
  2. ORM Strategy:
    • Can the project use Doctrine ORM alongside Eloquent, or is a full Eloquent migration required?
  3. Frontend Stack:
    • Is Twig acceptable, or must the team use Blade? If Blade, how will templates be rendered?
  4. Charting Needs:
    • Does the project require Symfony UX Chartjs, or can it use a Laravel-native alternative?
  5. Static Dashboard Use Case:
    • Is the static dashboard mode critical, or can it be replaced with a custom Laravel view?
  6. Performance Requirements:
    • Are 5-minute widget caches acceptable, or does the app need real-time updates (e.g., via Laravel Echo/Pusher)?
  7. Long-Term Maintenance:
    • Who will maintain the Symfony-Laravel integration layer (e.g., routing, DI, caching)?

Integration Approach

Stack Fit

Component Laravel Native Alternative Symfony Bundle Alternative Integration Strategy
Routing routes/web.php routes.yaml Use Symfony’s UrlGenerator in Laravel routes or create a custom route loader to merge Symfony routes into Laravel’s router.
Dependency Injection Laravel’s container (app() helper) Symfony’s autowiring Use Symfony’s ContainerInterface in Laravel or adopt a hybrid container (e.g., symfony/dependency-injection).
Templating Blade (@include, @component) Twig ({% extends %}, {{ }}) Option 1: Use Twig in Laravel via twig/bridge. Option 2: Render Twig templates via PHP strings in Blade (less ideal).
ORM Eloquent Doctrine ORM Option 1: Use Eloquent Doctrine Bridge (e.g., laravel-doctrine/orm). Option 2: Abstract queries into a repository layer compatible with both.
Forms Laravel Collective Forms Symfony Forms Use Symfony Forms in Laravel via Symfony’s FormFactory or replace with Laravel Collective Forms (manual mapping required).
Security Laravel’s Auth (Auth::user()) Symfony Security ($this->security->getUser()) Use Symfony’s Security component in Laravel or create a facade to bridge Laravel’s Auth with Symfony’s security context.
Caching Laravel Cache (Cache::get()) Symfony Cache ($cache->get()) Use Symfony’s CacheInterface with Laravel’s cache drivers via an adapter (e.g., symfony/cache-adapter).
Charting chartjs/chart.js Symfony UX Chartjs Option 1: Replace Symfony UX Chartjs with Laravel Chartjs (e.g., artesaos/laravel-chartjs). Option 2: Use Symfony UX Chartjs in a standalone JS context.
Asset Management Laravel Mix/Vite Symfony Encore Use Laravel Mix/Vite for assets and Symfony Encore only for widget-specific JS/CSS (if needed).

Migration Path

Phase 1: Proof of Concept (1-2 Weeks)

  1. Isolate the Bundle:
    • Install the bundle in a new Laravel project with Symfony components (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.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log