- Can I use **contao-components/jquery** in a Laravel project without Contao?
- This package is designed for Contao projects, not standalone Laravel apps. For Laravel, consider installing jQuery via npm (`npm install jquery`) or using a CDN directly. The package’s Contao-specific conventions may cause conflicts in vanilla Laravel setups.
- What jQuery version does this package provide, and how do I update it?
- The package ships upstream jQuery builds (e.g., 3.x). Update versions by modifying `composer.json` under `require` and running `composer update contao-components/jquery`. Always test updates for Contao compatibility, as breaking changes may occur.
- How do I include jQuery in Laravel Blade templates using this package?
- After installing via Composer, include jQuery in Blade by referencing the package’s asset path (check the package’s `resources` or `public` folder). For Contao projects, follow Contao’s asset pipeline conventions. Avoid global `$` conflicts by loading jQuery before Contao-specific scripts.
- Will this package work with Laravel Mix or Vite?
- No, this package is not optimized for Laravel Mix/Vite. For modern Laravel, install jQuery via npm (`npm install jquery`) and configure Mix/Vite to avoid duplicates. Use `externals` or `resolve.alias` in webpack to prevent bundling conflicts.
- Does this package support jQuery plugins (e.g., DataTables, Select2)?
- Yes, but plugins must be loaded *after* jQuery. For Contao projects, ensure plugins are included in the correct order via Contao’s asset pipeline. For Laravel, manually include plugin scripts in Blade or via npm if using a frontend build tool.
- Is **contao-components/jquery** secure? How do I handle jQuery vulnerabilities?
- jQuery is no longer actively maintained, so vulnerabilities may exist. Pin to a specific minor version (e.g., `3.6.0`) in `composer.json` and monitor Contao’s compatibility notes. For Laravel, consider modern alternatives like Alpine.js or vanilla JS to reduce dependency risks.
- Can I use this package alongside Alpine.js or Livewire in Laravel?
- jQuery and Alpine.js/Livewire can coexist, but `$` conflicts may arise. Load jQuery first, then Alpine.js/Livewire. For Contao projects, test thoroughly—some Contao modules rely on jQuery’s DOM APIs. In Laravel, prefer Alpine.js for reactivity to avoid jQuery entirely.
- How do I lazy-load jQuery to improve performance?
- This package doesn’t natively support lazy-loading. For Contao, defer jQuery via Contao’s asset pipeline settings. In Laravel, use a CDN with `defer` or lazy-load jQuery dynamically in JavaScript (e.g., `if (!window.jQuery) { loadScript('jquery.min.js'); }`).
- What’s the difference between this package and installing jQuery via npm?
- This package is tailored for Contao’s PHP/Composer ecosystem, ensuring version consistency with Contao’s requirements. npm installation gives more control for Laravel/Mix/Vite but lacks Contao-specific optimizations. Choose npm for modern Laravel; use this package only for Contao integrations.
- Does this package work with Laravel 10+ and PHP 8.2?
- The package itself is PHP-agnostic, but jQuery 3.x supports modern browsers. Test compatibility with Contao’s latest version, as Contao may enforce specific jQuery features. For Laravel, ensure no PHP version conflicts arise during Composer installation (e.g., `platform-check` in `composer.json`).