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

Core Bundle Laravel Package

customscripts/core-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the bundle to your composer.json:

    composer require customscripts/core-bundle
    

    Enable it in config/bundles.php:

    return [
        // ...
        CustomScripts\CoreBundle\CSCoreBundle::class => ['all' => true],
    ];
    
  2. First Use Case Use the built-in layouts in Twig templates. Override the base template in templates/base.html.twig:

    {% extends 'CSCoreBundle::layout.html.twig' %}
    

    Choose a layout variant (e.g., one_column_left) by setting:

    {% block layout %}
        {{ parent() }} {# Inherits the selected layout #}
    {% endblock %}
    
  3. Asset Integration Assets (Bootstrap, jQuery, etc.) are auto-registered via Twig’s assets function. Verify in app/config/config.yml:

    twig:
        paths:
            '%kernel.project_dir%/vendor/customscripts/core-bundle/Resources/views': CSCoreBundle
    

Implementation Patterns

Layout Customization

  1. Extending Layouts Override layout.html.twig in your theme to modify structure:

    {% extends 'CSCoreBundle::layout.html.twig' %}
    {% block sidebar %}
        {{ include('YourBundle::custom_sidebar.html.twig') }}
    {% endblock %}
    
  2. Dynamic Layout Selection Use Twig logic to switch layouts per route:

    {% set layout = app.request.attributes.get('_route') == 'admin' ? 'one_column_right' : '3_columns' %}
    {% block layout %}
        {{ render(controller('CSCoreBundle:Layout:layout', {'layout': layout})) }}
    {% endblock %}
    

Asset Management

  1. Custom JavaScript/CSS Add assets to web/js/ or web/css/ and reference them in Twig:

    {{ assets('bundles/yourbundle/js/custom.js') }}
    

    Ensure assets are compiled via Symfony’s asset pipeline (e.g., Webpack Encore).

  2. Overriding Default Assets Replace vendor assets by copying files to web/ (e.g., web/css/bootstrap.css). Symfony’s asset system will prioritize local files.

Common Workflows

  1. Admin vs. Frontend Theming Use environment-based Twig includes:

    {% if app.environment == 'prod' %}
        {{ assets('bundles/yourbundle/css/prod.css') }}
    {% else %}
        {{ assets('bundles/yourbundle/css/dev.css') }}
    {% endif %}
    
  2. Modular Components Break templates into reusable components (e.g., components/navbar.html.twig) and include them:

    {{ include('YourBundle::components/navbar.html.twig') }}
    

Gotchas and Tips

Pitfalls

  1. Asset Versioning

    • The bundle uses static asset versions (e.g., bootstrap.min.css?v=3.3.5). Override by configuring assets_version in config.yml:
      cscore:
          assets_version: '1.0.0'  # Custom version string
      
    • Debugging: Clear cache (php bin/console cache:clear) if assets fail to load after overrides.
  2. Layout Inheritance Conflicts

    • If extending layout.html.twig breaks, check for missing {% block %} definitions. Use {{ dump(app.request.attributes) }} to debug route attributes.
  3. Font Awesome Icons

    • Icons require font-awesome.css to be loaded. Verify in layout.html.twig:
      {{ assets('bundles/cscore/vendor/font-awesome/css/font-awesome.min.css') }}
      

Debugging Tips

  1. Twig Template Paths List all loaded templates:

    php bin/console debug:twig
    

    Filter for CSCoreBundle to verify inheritance.

  2. Asset Compilation

    • For Webpack Encore, ensure webpack.config.js includes:
      Encore.enableSassLoader();
      Encore.addEntry('app', './assets/app.scss');
      
    • Rebuild assets:
      npm run dev
      

Extension Points

  1. Custom Layouts Add new layouts by creating Resources/views/Layout/ in your bundle and reference them via:

    {{ render(controller('CSCoreBundle:Layout:layout', {'layout': 'custom_layout'})) }}
    
  2. Asset Overrides Extend the bundle’s Resources/public/ directory by creating a YourBundle/Resources/public/ folder. Symfony’s asset system merges paths alphabetically.

  3. Configuration Override default settings in config/packages/cscore.yaml:

    cscore:
        default_layout: 'full_width'  # Override default
        enabled_assets:
            - 'jquery'
            - 'modernizr'  # Disable by removing
    
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.
andydefer/laravel-cluster
aimeos/ai-admin-mcp
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor