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

Jquery Bundle Laravel Package

ajgl/jquery-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Install via Composer:

    composer require ajgl/jquery-bundle
    

    Note: This package is outdated (Symfony 2.x only) and lacks modern Composer support. Use symfony/webpack-encore or symfony/ux-jquery for Symfony 5/6.

  2. Enable the Bundle (Symfony 2.x only): Add to app/AppKernel.php:

    new Ajgl\JQueryBundle\AjglJQueryBundle(),
    
  3. First Use Case: Inject jQuery into a Twig template:

    {{ ajgl_jquery_js() }}  {# Renders jQuery script tag #}
    

Implementation Patterns

Core Workflows

  1. Asset Integration:

    • Use ajgl_jquery_js() in Twig to include jQuery globally.
    • Override default version via config (ajgl_jquery.version: "3.6.0").
  2. Bundle-Specific Usage:

    • Extend with custom plugins via ajgl_jquery.plugins config:
      # config.yml
      ajgl_jquery:
          plugins: ["ui", "validate"]
      
    • Note: Plugins must be manually managed (e.g., via assets:install).
  3. Symfony 2.x Asset Pipeline:

    • Combine with Assetic for minification:
      # app/config/config.yml
      assetic:
          bundles: [AjglJQueryBundle]
      
  4. Dependency Injection:

    • Access jQuery version in PHP:
      $this->get('ajgl_jquery.version');  // Returns configured version
      

Gotchas and Tips

Pitfalls

  1. Symfony Version Mismatch:

    • Requires Symfony 2.x. Not compatible with Symfony 4/5/6.
    • Workaround: Use symfony/ux-jquery for modern Symfony.
  2. Plugin Management:

    • No built-in plugin installation. Manually include files (e.g., jquery-ui.js) in web/bundles/ajgljquery/.
  3. Asset Debugging:

    • Debug mode (APP_DEBUG=true) may break if jQuery path is misconfigured.
    • Verify paths in Resources/public/js/jquery.js.
  4. Composer Conflicts:

    • May conflict with other jQuery bundles (e.g., stof/doctrine-extensions-bundle).
    • Fix: Explicitly require jQuery via composer require jquery/jquery.

Debugging Tips

  • Check Output: Inspect rendered HTML for <script> tags:
    {{ dump(ajgl_jquery_js()) }}
    
  • Clear Cache: After config changes:
    php app/console cache:clear
    

Extension Points

  1. Custom Templates: Override Twig templates in app/Resources/AjglJQueryBundle/views/:

    {# app/Resources/AjglJQueryBundle/views/Default/jquery.js.twig #}
    <script src="{{ asset('custom/jquery.min.js') }}"></script>
    
  2. Event Listeners: Extend bundle logic via Symfony events (e.g., kernel.request):

    // src/AcmeBundle/EventListener/JQueryListener.php
    public function onKernelRequest(GetResponseEvent $event) {
        $request = $event->getRequest();
        if ($request->attributes->has('custom_jquery')) {
            // Modify jQuery behavior
        }
    }
    
  3. Configuration Overrides: Use parameters.yml to override defaults:

    parameters:
        ajgl_jquery.version: "3.6.0"
        ajgl_jquery.cdn: false
    
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
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