Download the PHP package julienlinard/php-carousel without Composer
On this page you can find all versions of the php package julienlinard/php-carousel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download julienlinard/php-carousel
More information about julienlinard/php-carousel
Files in julienlinard/php-carousel
Package php-carousel
Short Description A modern and performant carousel library for PHP with beautiful designs, no external dependencies. Pure CSS/JS native implementation.
License MIT
Homepage https://github.com/julien-lin/php-carousel
Informations about the package php-carousel
PHP Carousel
๐ฌ๐ง Read in English
๐ Support the project
If this bundle is useful to you, consider becoming a sponsor to support the development and maintenance of this open source project.
A modern and performant carousel library for PHP with beautiful designs. Pure CSS/JS native implementation with zero external dependencies.
๐ Installation
Requirements: PHP 8.2 or higher
Optional Dependencies
The core library has zero external dependencies. However, if you want to use Twig or Blade integrations, you need to install the corresponding packages:
For Twig integration:
For Blade integration (Laravel):
Note: These dependencies are optional. The core carousel functionality works without them. They are only needed if you use the Twig or Blade extensions.
โก Quick Start
Simple Image Carousel
Card Carousel
Testimonial Carousel
๐จ Visual Demos
See the carousels in action! Each type is fully customizable and responsive with smooth animations.
Image Carousel
Perfect for hero banners and image galleries with smooth slide transitions.
Card Carousel
Ideal for product listings, blog posts, or feature showcases. Displays multiple items per slide.
Testimonial Carousel
Beautiful fade transitions for customer reviews and testimonials.
Gallery Carousel
Advanced gallery with thumbnail navigation for easy browsing.
๐ Features
- โ Zero Dependencies - Pure CSS/JS native implementation
- โ Multiple Types - Image, Card, Testimonial, Gallery, Infinite carousels
- โ
Static Factory Methods -
infiniteCarousel(),heroBanner(),productShowcase(),testimonialSlider() - โ Twig & Blade Integration - Ready-to-use extensions for popular templating engines
- โ Fully Responsive - Mobile, tablet, and desktop optimized
- โ Touch Swipe - Native touch gestures support
- โ Keyboard Navigation - Accessible keyboard controls
- โ Autoplay - Configurable autoplay with pause on hover
- โ Smooth Animations - CSS transitions and transforms
- โ Lazy Loading - Built-in image lazy loading with Intersection Observer
- โ Customizable - Extensive configuration options
- โ WCAG 2.1 AA Compliant - Full accessibility support (ARIA, screen readers, prefers-reduced-motion)
- โ Security - XSS prevention, URL validation, input sanitization
- โ Performance - Modular renderer architecture, optimized JavaScript, CSS/JS minification, virtualization for large carousels
- โ Themes - Dark/Light mode support with automatic system preference detection
- โ Virtualization - Automatic performance optimization for carousels with 50+ items
- โ Server-Side Rendering (SSR) - Static HTML generation for SEO and CDN caching
- โ Built-in Analytics - Automatic tracking of impressions, clicks, and interactions with detailed reports
- โ A/B Testing Built-in - Integrated variant testing with cookie, hash, or random selection
- โ Error Handling - Image error placeholders, loading indicators
๐ Documentation
Core Documentation
- API Reference - Complete API documentation
- Best Practices - Production-ready guidelines
- Migration Guide - Migrate from Swiper.js
- Troubleshooting - Common issues and solutions
Advanced Topics
- Security policy and best practices - Reporting vulnerabilities, secure usage
- Accessibility Guide - WCAG 2.1 AAA compliance
- Performance Guide - Optimization techniques
- Cache and HTTP headers - Cache-Control, ETag (app responsibility)
- E2E Testing - End-to-end testing guide
Integration Guides
- CMS Integration - WordPress, PrestaShop, Drupal
- Twig Integration - Twig templating engine
- Blade Integration - Laravel Blade templating
- React Integration - React.js integration
- Vue Integration - Vue.js integration
Examples & Tutorials
- CodePen Examples - Interactive examples
- Video Tutorials - Tutorial scripts
- Usage Examples - Code examples
Carousel Types
Image Carousel
Perfect for image galleries and hero banners.
Card Carousel
Ideal for product listings, blog posts, or feature cards.
Testimonial Carousel
Perfect for customer reviews and testimonials.
Gallery Carousel
Advanced gallery with thumbnails navigation.
Configuration Options
Advanced Usage
Custom Items
Separate HTML, CSS, and JS
Dark/Light Theme Support
Virtualization for Large Carousels
Custom Transitions and Animations
Export/Import Configuration
Server-Side Rendering (SSR)
SSR Benefits:
- โ Perfect SEO (content in HTML)
- โ Fast initial load (no JavaScript required)
- โ CDN cacheable
- โ Progressive enhancement (add JS when needed)
Built-in Analytics
A/B Testing Built-in
Multiple Carousels on Same Page
๐จ Styling
The carousel uses pure CSS with no external dependencies. All styles are scoped to the carousel container to avoid conflicts.
Custom Styling
You can override styles using CSS:
๐ API Reference
Carousel Class
Static Factory Methods
Carousel::image(string $id, array $images, array $options = []): self- Image carouselCarousel::card(string $id, array $cards, array $options = []): self- Card carouselCarousel::testimonial(string $id, array $testimonials, array $options = []): self- Testimonial carouselCarousel::gallery(string $id, array $images, array $options = []): self- Gallery carouselCarousel::infiniteCarousel(string $id, array $images, array $options = []): self- Infinite scrolling carouselCarousel::heroBanner(string $id, array $banners, array $options = []): self- Hero banner carouselCarousel::productShowcase(string $id, array $products, array $options = []): self- Product showcase carouselCarousel::testimonialSlider(string $id, array $testimonials, array $options = []): self- Testimonial slider
Instance Methods
addItem(CarouselItem|array $item): self- Add a single itemaddItems(array $items): self- Add multiple itemssetOptions(array $options): self- Set carousel optionsgetOption(string $key, mixed $default = null): mixed- Get an option valuerender(): string- Render complete carousel (HTML + CSS + JS)renderHtml(): string- Render only HTMLrenderCss(): string- Render only CSSrenderJs(): string- Render only JavaScriptrenderStatic(): string- Render static HTML with CSS (SSR, no JS)hydrate(string $staticHtml): string- Add JavaScript to static HTMLgetId(): string- Get carousel IDgetType(): string- Get carousel typegetItems(): array- Get all itemsgetOptions(): array- Get all optionsexportConfig(): array- Export configuration to arrayfromConfig(array $config): self- Create carousel from configuration (static)
CarouselItem Class
Constructor
Static Methods
CarouselItem::fromArray(array $data): self- Create from array
Instance Methods
toArray(): array- Convert to array
๐ก Examples
Example 1: Product Carousel
Example 2: Hero Banner Carousel
Example 3: Customer Testimonials
๐ Integrations
Twig Integration
See INTEGRATION_TWIG.md for complete documentation.
Blade Integration (Laravel)
See INTEGRATION_BLADE.md for complete documentation.
๐งช Tests
Test Coverage:
- โ 60 tests, 200 assertions
- โ Security tests (XSS prevention, URL validation, input sanitization)
- โ Accessibility tests (ARIA attributes, screen readers, prefers-reduced-motion)
- โ Integration tests (Twig, Blade)
- โ Functional tests (all carousel types and methods)
๐ Additional Documentation
- API Reference - Complete API documentation
- Twig Integration - Twig extension guide
- Blade Integration - Laravel Blade guide
- Usage Examples - More examples
๐ License
MIT License - See the LICENSE file for more details.
๐ค Contributing
Contributions are welcome! Feel free to open an issue or a pull request.
๐ง Support
For any questions or issues, please open an issue on GitHub.
๐ Support the project
If this bundle is useful to you, consider becoming a sponsor to support the development and maintenance of this open source project.
Developed with โค๏ธ by Julien Linard