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

Swiper Laravel Package

contao-components/swiper

Contao integration for Swiper.js, providing a ready-to-use slider/carousel component. Adds Swiper assets and configuration to Contao so you can build responsive, touch-friendly sliders with minimal setup.

View on GitHub
Deep Wiki
Context7

Swiper integration

Frequently asked questions about Swiper
How do I install contao-components/swiper in a Laravel project?
Use Composer: `composer require contao-components/swiper`. The package auto-registers Swiper’s assets via Laravel Mix/Vite if configured. For Contao CMS, follow the package’s Contao-specific setup instructions in the README, which may require additional asset pipeline adjustments.
Does this package work with Laravel Livewire or Alpine.js?
Yes, the package is designed to integrate smoothly with Livewire/Alpine.js. You can dynamically configure sliders via PHP (e.g., passing data from Livewire props) and trigger events like slide changes using Alpine.js or Livewire’s JavaScript hooks. Check the package’s Blade directives for reactive integration.
Can I use this package without Contao CMS in a pure Laravel app?
While the package is optimized for Contao, it can work in vanilla Laravel projects by manually configuring asset loading (CSS/JS) in your `resources/js` or `resources/css` folders. The core Swiper functionality remains the same, but you’ll need to handle initialization via Blade or JavaScript.
What Laravel versions does contao-components/swiper support?
The package targets modern Laravel versions (8.x and 9.x). For Laravel 10+, verify compatibility with the package’s asset pipeline (Mix/Vite) and PHP dependencies. The README should specify supported versions, but test thoroughly if using edge cases like custom asset paths.
How do I dynamically load slides from a Laravel database?
Configure the slider via PHP arrays or Blade directives, then pass Eloquent collections or query results to Swiper’s `slides` option. For example, loop through a `Product` model in Blade and render each slide with dynamic content. The package abstracts this into a clean PHP interface.
Will this package conflict with jQuery or other JavaScript libraries?
Swiper.js is jQuery-free by default, but if you enable legacy mode (e.g., for Contao compatibility), conflicts may arise. Use unique IDs for Swiper instances and audit your JS bundle for duplicates. For modern Laravel apps, prefer Swiper’s vanilla JS mode to avoid conflicts entirely.
Can I customize Swiper’s breakpoints or responsive settings via PHP?
Yes, the package allows PHP-based configuration for breakpoints, responsive settings, and other Swiper options. Define these in your service provider or Blade template, and the package will inject them into Swiper’s initialization. This avoids hardcoding values in JavaScript.
How do I handle Swiper events (e.g., slide change) in Laravel?
Use Swiper’s built-in events with JavaScript callbacks, or integrate with Laravel via Livewire/Alpine.js. For example, bind to the `slideChange` event in Alpine.js and dispatch a Livewire event to update PHP state. The package doesn’t natively expose events to PHP, so JS is required for real-time interactions.
Is there PHPUnit testing for Laravel integration, or should I write my own?
The package may include basic tests for Swiper’s core functionality, but Laravel-specific integration tests (e.g., Blade directives, asset loading) are likely minimal. Write custom tests for your setup using Laravel’s testing helpers, focusing on asset compilation, dynamic data binding, and event handling.
What’s the best alternative if I need a simpler slider for Laravel?
For lightweight needs, consider vanilla Swiper.js (no PHP wrapper) or Laravel-specific packages like `spatie/laravel-swiper` (if available). If you’re using Bootstrap, its native carousel may suffice. For Contao, this package is the most feature-rich option, but for pure Laravel, evaluate whether the abstraction layer adds unnecessary complexity.
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.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle