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

Ccdn Component Dashboard Bundle Laravel Package

codeconsortium/ccdn-component-dashboard-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require codeconsortium/ccdn-component-dashboard-bundle
    

    Add to AppKernel.php:

    new CodeConsortium\CCDNComponentDashboardBundle\CCDNComponentDashboardBundle(),
    
  2. Enable Dashboard Configure routing in app/config/routing.yml:

    ccdn_component_dashboard:
        resource: "@CCDNComponentDashboardBundle/Resources/config/routing.yml"
        prefix:   /
    
  3. First Use Case Register a dashboard link from a custom bundle via a service tag:

    # app/config/services.yml
    services:
        my_bundle.dashboard_integrator:
            class: MyBundle\Dashboard\DashboardIntegrator
            tags:
                - { name: ccdn_component_dashboard.integrator }
    

    Define the integrator class:

    namespace MyBundle\Dashboard;
    
    use CodeConsortium\CCDNComponentDashboardBundle\Dashboard\DashboardIntegratorInterface;
    
    class DashboardIntegrator implements DashboardIntegratorInterface
    {
        public function getLinks()
        {
            return [
                [
                    'label' => 'My Bundle',
                    'route' => 'my_route',
                    'icon'  => 'glyphicon glyphicon-home',
                    'order' => 1,
                ],
            ];
        }
    }
    

Implementation Patterns

Core Workflow

  1. Service Registration Use ccdn_component_dashboard.integrator tag to register dashboard links from any bundle. Avoid coupling by keeping integrators lightweight and focused on link definitions.

  2. Dynamic Link Generation Leverage Symfony’s dependency injection to fetch services dynamically:

    public function getLinks()
    {
        $links = [];
        foreach ($this->container->getParameter('my_config') as $item) {
            $links[] = [
                'label' => $item['name'],
                'route' => 'item_route',
                'icon'  => $item['icon'],
            ];
        }
        return $links;
    }
    
  3. Conditional Rendering Use isActive() in integrators to highlight current routes:

    public function isActive($routeName)
    {
        return $routeName === 'my_active_route';
    }
    
  4. Grouping Links Organize links into collapsible sections using the group key:

    return [
        [
            'group' => 'Admin',
            'links' => [
                ['label' => 'Users', 'route' => 'user_index'],
                ['label' => 'Settings', 'route' => 'settings_index'],
            ],
        ],
    ];
    

Integration Tips

  • Twig Integration Extend the default template (Resources/views/Dashboard/dashboard.html.twig) to customize rendering:

    {% extends 'CCDNComponentDashboardBundle::dashboard.html.twig' %}
    {% block dashboard_title %}{{ 'Custom Dashboard'|trans }}{% endblock %}
    
  • Asset Management Override CSS/JS by extending the bundle’s asset paths in your assets.yml:

    assets:
        dashboard_styles:
            inputs:
                - { resource: "@CCDNComponentDashboardBundle/Resources/public/css/dashboard.css" }
                - { resource: "path/to/your/custom.css" }
    
  • Authentication Secure the dashboard route in security.yml:

    security:
        access_control:
            - { path: ^/dashboard, roles: ROLE_USER }
    

Gotchas and Tips

Common Pitfalls

  1. Symfony Version Mismatch The bundle targets Symfony 2.4 and PHP 5.4. Use a compatibility layer (e.g., symfony/symfony:2.4.*) if upgrading:

    composer require symfony/symfony:2.4.*
    
  2. Service Tag Misconfiguration Ensure the tag name is exactly ccdn_component_dashboard.integrator (case-sensitive). Verify with:

    php app/console debug:container --tag=ccdn_component_dashboard.integrator
    
  3. Routing Conflicts The default route (/dashboard) may clash with other bundles. Override in routing.yml:

    ccdn_component_dashboard:
        resource: "@CCDNComponentDashboardBundle/Resources/config/routing.yml"
        prefix:   /admin/dashboard  # Custom prefix
    
  4. Icon Dependencies The bundle relies on Bootstrap Glyphicons. If missing, add to your layout:

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-glyphicons.css">
    

Debugging Tips

  • Check Registered Integrators Dump integrators in a controller:

    $integrators = $this->get('ccdn_component_dashboard.dashboard_integrator_collection');
    dump($integrators->getIntegrators());
    
  • Log Link Generation Enable debug mode and check app/logs/dev.log for errors during link compilation.

  • Template Overrides Clear cache after extending Twig templates:

    php app/console cache:clear
    

Extension Points

  1. Custom Dashboard Layout Override the entire dashboard template by copying Resources/views/Dashboard/dashboard.html.twig to app/Resources/CCDNComponentDashboardBundle/views/Dashboard/.

  2. Dynamic Integrator Loading Implement DashboardIntegratorInterface to fetch links from external APIs:

    public function getLinks()
    {
        $client = new \GuzzleHttp\Client();
        $response = $client->get('https://api.example.com/links');
        return json_decode($response->getBody(), true);
    }
    
  3. Event Listeners Extend dashboard behavior via events (e.g., ccdn_component_dashboard.build):

    services:
        my_bundle.dashboard_listener:
            class: MyBundle\EventListener\DashboardListener
            tags:
                - { name: kernel.event_listener, event: ccdn_component_dashboard.build, method: onBuild }
    
  4. Localization Translate link labels using Symfony’s translation system:

    return [
        'label' => 'my_bundle.dashboard.link_label', // Translatable key
        'route' => 'my_route',
    ];
    

    Define translations in app/Resources/translations/messages.en.yml:

    my_bundle:
        dashboard:
            link_label: "Custom Label"
    
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.
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver