Install via Composer (if still usable):
composer require ajgl/jqueryui-bundle
Note: Due to Symfony 2.x dependency (<2.2-dev), this may require legacy tooling or a Symfony 2.x project.
Enable the Bundle in app/AppKernel.php:
new Ajgl\JQueryUiBundle\AjglJQueryUiBundle(),
Ensure Ajgl\JQueryBundle (dependency) is also installed/enabled.
First Use Case: Basic jQuery UI Integration
Add the bundle’s assets to your base template (base.html.twig):
{{ ajgl_jqueryui_bundle_javascript() }}
Include the CSS in your layout:
{{ ajgl_jqueryui_bundle_stylesheets({
theme: 'ui-lightness', // Default theme
components: ['core', 'widget'] // Load only needed components
}) }}
Verify Installation
Check the generated <head> for loaded jQuery UI assets and confirm the bundle’s Twig functions work.
Selective Loading Use Twig functions to load only required components (reduces payload):
{{ ajgl_jqueryui_bundle_javascript({
components: ['dialog', 'datepicker']
}) }}
Theme Customization
Override the default theme via config (config.yml):
ajgl_jqueryui:
theme: 'smoothness' # Custom theme path: `web/bundles/ajgljqueryui/themes/smoothness`
Place themes in src/Ajgl/JQueryUiBundle/Resources/public/themes/ for autoloading.
Symfony Asset Integration Combine with Symfony’s Asset component for versioned URLs:
{% for css in ajgl_jqueryui_bundle_stylesheets() %}
{{ asset(css) }}
{% endfor %}
Event-Driven Initialization Initialize jQuery UI widgets via JavaScript (e.g., after DOM ready):
$(document).ready(function() {
$('#datepicker').datepicker(); // Requires 'datepicker' component
});
ajgl_jqueryui_bundle_javascript({'components': ['dialog']}) + custom markup.Ajgl\JQueryBundle for AJAX form handling + jQuery UI widgets (e.g., autocomplete).Symfony 2.x Dependency
sensio/distribution-bundle:2.0.*).Missing Documentation
Resources/doc/index.md is referenced but not publicly available in the repo.AjglJQueryUiBundle.php and Resources/views/ for undocumented features.Theme Path Assumptions
web/bundles/ajgljqueryui/themes/. Custom themes must be manually placed here.ThemeLoader.jQuery Dependency
ajgl/jquery-bundle (v1.8.2). Ensure it’s installed and loaded before jQuery UI.jQuery is not defined errors.Component Naming
'datepicker') must match jQuery UI’s official names. Typos break loading.Asset Loading Issues:
web/bundles/ajgljqueryui/ after app/console assets:install.php app/console cache:clear --env=prod.Console Errors:
Uncaught ReferenceError: $ is not defined → Ensure jQuery is loaded first.404 on theme/CSS files → Confirm paths in config.yml.Custom Components Extend the bundle to add non-standard jQuery UI components:
// src/Ajgl/JQueryUiBundle/DependencyInjection/AjglJQueryUiExtension.php
$loader->addComponents(array(
'custom_component' => array('path' => 'path/to/custom.js'),
));
Asset Versioning
Override the AssetLoader to add query strings for cache busting:
// src/Ajgl/JQueryUiBundle/Resources/config/services.yml
ajgl_jqueryui.asset_loader:
class: Your\CustomAssetLoader
arguments: [@asset_packages]
Symfony 3+/4/5 Compatibility Fork the bundle and update:
composer.json (drop Symfony 2.x constraints).AjglJQueryUiBundle.php (extend Bundle base class).Twig_Extension with TwigExtensionInterface.Ajgl\JQueryBundle before Ajgl\JQueryUiBundle in AppKernel.php.assetic or webpack to minify jQuery UI assets in production.{% if ajgl_jqueryui_bundle_is_loaded() %}
{{ ajgl_jqueryui_bundle_javascript() }}
{% else %}
{{ include('bundles/yourtheme/jquery-ui-fallback.js') }}
{% endif %}
How can I help you explore Laravel packages today?