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.
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:
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.DependencyInjection/ — the extension and configuration tree. This is where the jQuery version, CDN-vs-local toggle, and template path are (or aren't) defined.Resources/views/ — the Twig partial(s) you'd {% include %} in a layout.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>'; ?>");
}
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.
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.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.{% javascripts %}), which is dead. Rewrite those tags for Encore or plain asset().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.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.jquery and confirm exactly one <script> tag survives.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.How can I help you explore Laravel packages today?