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

Jquery Bundle Laravel Package

rmzamora/jquery-bundle

rmzamora/jquery-bundle is a Symfony bundle for integrating jQuery into your application, simplifying asset inclusion and template usage so you can add jQuery to views with minimal configuration. Useful for legacy projects or apps that still rely on jQuery.

View on GitHub
Deep Wiki
Context7

Getting Started

First, the framing: RmzamoraJqueryBundle is a Symfony bundle, not a Laravel package. There is no service provider, no config/ publish tag, and no composer require rmzamora/jquery-bundle path into a Laravel app. As a Laravel developer your realistic entry point is either (a) you've inherited a Symfony codebase that uses it, or (b) you're reading it as a reference for how to wrap a JS library for a framework.

Where to look first, in order:

  1. RmzamoraJqueryBundle.php — the bundle class. In old Symfony this was registered in AppKernel::registerBundles(); on Symfony 4+ it's config/bundles.php. That single file tells you the supported Symfony generation.
  2. DependencyInjection/ — the extension and configuration tree. This is where the jQuery version, CDN-vs-local toggle, and template path are (or aren't) defined.
  3. Resources/views/ — the Twig partial(s) you'd {% include %} in a layout.
  4. Resources/public/ — the vendored jquery.min.js. If it's here, the bundle is an asset shipper, not much more.

Minimal Symfony install, assuming it still boots on your Symfony version:

// config/bundles.php
Rmzamora\JqueryBundle\RmzamoraJqueryBundle::class => ['all' => true],
php bin/console assets:install --symlink
{# templates/base.html.twig #}
{{ include('@RmzamoraJquery/layout.html.twig') }}

First use case: getting a single <script src="...jquery..."> tag into your base layout without hand-managing the file. That is essentially the whole value proposition. For a Laravel developer, the equivalent you'd actually ship is a one-line Blade directive or a Vite entry — see below.

If you're on Laravel and want the same outcome, don't fight the mismatch. Reproduce the pattern:

// app/Providers/JqueryServiceProvider.php
public function boot(): void
{
    Blade::directive('jquery', fn () => "<?php echo '<script src=\"'.asset('vendor/jquery/jquery.min.js').'\"></script>'; ?>");
}

Implementation Patterns

Layout inclusion (the intended pattern). The bundle expects you to include a Twig partial once, in the <head> or before </body>. Everything else — version pinning, CDN fallback — depends on whether the bundle's DI extension exposes parameters. Check Configuration.php; if it's empty, the version is hardcoded in the template and your only override is bundle inheritance.

Asset publishing. Classic Symfony bundles expose Resources/public, which lands in web/bundles/rmzamorajquery/ (Symfony ≤4) or public/bundles/... (5+). Reference it as {{ asset('bundles/rmzamorajquery/js/jquery.min.js') }} after assets:install. Never reference Resources/public directly at runtime — it isn't web-accessible.

CDN-with-local-fallback. If the bundle implements this, it'll be a Twig conditional around app.request or a config flag. The pattern worth copying into Laravel:

<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script>window.jQuery || document.write('<script src="{{ asset('vendor/jquery/jquery.min.js') }}"><\/script>')</script>

Template override. Symfony resolves @RmzamoraJquery/... through bundle inheritance. To change the markup without forking, create templates/bundles/RmzamoraJqueryBundle/layout.html.twig in your app — it wins over the bundle's copy. This is the cleanest extension point the package offers and the one to document for your team.

Encore / Vite integration. Don't mix the bundle's <script> tag with a modern build pipeline. Pick one. If you're on Encore, drop the bundle's script tag and require('jquery') in assets/app.js instead; jQuery then attaches to window only if you explicitly do global.$ = global.jQuery = require('jquery'). Duplicate jQuery instances are the single most common failure mode.

Laravel translation of the same idea. A vendor:publish-able asset plus a Blade component:

php artisan vendor:publish --tag=jquery-assets
<x-jquery-cdn />   {{-- renders <x-jquery-cdn> from resources/views/components --}}

Keep it to a component, not a package. A whole Composer package for one script tag is over-engineering — which is arguably the historical sin this bundle commits.

Gotchas and Tips

  • Archived, zero dependents, zero stars. Treat it as unmaintained. Do not add it to a production composer.json; vendor the two files you need or copy the pattern. There will be no security patches for the bundled jQuery version, which matters more than anything else here — a pinned old jQuery is a real CVE surface.
  • Symfony generation mismatch. If the bundle predates Symfony 4, it targets AppKernel, Resources/config/services.yml, and web/. Dropping it into a Symfony 6/7 app will fail at autoloading or container compilation. Check composer.json's symfony/framework-bundle constraint before anything else.
  • Assetic baggage. Bundles of this vintage often assume Assetic ({% javascripts %}), which is dead. Rewrite those tags for Encore or plain asset().
  • Cache and install confusion. After assets:install, stale files persist. Use --symlink in dev, and rm -rf var/cache/* when template overrides don't appear — Twig caches resolved bundle templates aggressively.
  • Namespace casing. Rmzamora vs rmzamora in the namespace/P.S.R-4 path is a classic autoload break on case-sensitive filesystems (Linux CI vs macOS dev). Verify the directory name matches the namespace exactly.
  • Double-loading jQuery. The most frequent production bug: the bundle includes jQuery and your theme/plugin includes it. jQuery plugins silently bind to whichever instance loaded first. Grep your rendered HTML for jquery and confirm exactly one <script> tag survives.
  • Extension points are thin. Realistically you get template override via bundle inheritance and, if you're lucky, one DI parameter for the version. There is no event, no tagged service, no compiler pass. Plan on forking if you need behavior changes — another reason to just copy the two files into your own repo and delete the dependency.
  • For Laravel specifically: skip the bundle entirely. npm install jquery plus a Vite entry, or a Blade::directive, gives you the same result with a maintained dependency and no Symfony bridge. The only durable takeaway from this package is the shape of the solution: publish the asset, expose one include point, document the override path.
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.
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource