Download the PHP package ianhobbs/kirby-swiper-block without Composer

On this page you can find all versions of the php package ianhobbs/kirby-swiper-block. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kirby-swiper-block

Packagist Version Kirby 4+ License MIT

Kirby Swiper Block

A Kirby CMS layout block plugin that renders a full-featured Swiper 12 slider with a Panel editor, responsive image cropping, lazy loading, and LQIP blur-up placeholders.

Swiper is loaded via CDN — no npm or build step required to use the plugin.

Requires: Kirby 4 or 5 · PHP 8.1+


Installation

Via Composer (recommended)

Manual

Clone into your site's site/plugins/ directory:


Zero-config setup

No template changes needed. When a page contains a Swiper block, the snippet automatically injects the Swiper CDN scripts and plugin CSS once per page load using a static flag. Everything is self-contained.

If you prefer to control asset placement (e.g. move them to <head> for performance), add these lines to your layout template and set SWIPER_ASSETS_LOADED in your config — see Manual asset loading below.


Usage in the Panel

Add the swiper block type to any blocks or layout field in your blueprint:

The block editor opens with 5 tabs covering all configuration options:

Tab 1 — Slides (per-slide settings)

Field Description
Image Single image — min. 1920 × 810 px recommended
Heading Slide title
Subtext / Caption Optional body text
CTA Link + Label Optional call-to-action button
Content Position Left / Centre / Right

Tab 2 — Layout

Field Default Description
Aspect Ratio 16:9 21:9 / 16:9 / 4:3 / 1:1 / Custom height
Custom Height 600 px Fixed height in px (when Aspect Ratio = Custom)
Slider Height 0 (auto) Explicit container height in px / vh / svh — 0 = auto. Decouples height from images so text-only slides don't collapse; takes precedence over Aspect Ratio. See Slider height & avoiding collapse
Height Unit px Unit for Slider Height — px / vh / svh
Slide Direction Horizontal Scroll direction — Horizontal or Vertical
Orientation Horizontal Image crop set — Horizontal (16:9 → swiper-horiz) or Vertical (9:16 → swiper-vert)
Slides Visible 1 1 / 2 / 3 / 4 / Auto
Advance Per Click 1 Slides to jump per navigation action
Gap Between Slides 0 px Spacing between slides
Centre Active Slide Off Keeps the active slide centred
Starting Slide 0 Zero-based index of the first visible slide

Tab 3 — Animation

Field Default Description
Transition Effect Slide Slide / Fade / Creative (zoom) / Coverflow
Transition Speed 600 ms 100–3000 ms
Loop On Infinite loop
Autoplay Off Auto-advances slides
Autoplay Delay 4000 ms Delay between slides (when Autoplay is On)
Pause on Hover On Pauses autoplay on mouse enter (when Autoplay is On)
Free Mode Off Slides move freely without snapping
Free Mode Momentum On Momentum-based deceleration (when Free Mode is On)

Tab 4 — Controls

Field Default Description
Arrow Buttons Visible Previous / Next navigation arrows
Pagination Visible Pagination indicator
Pagination Style Bullets Bullets / Fraction (2/5) / Progress Bar
Dynamic Bullets On Active bullet enlarges relative to neighbours
Keyboard Navigation On Arrow keys navigate slides when in viewport
Mousewheel Control Off Scroll wheel advances slides

Tab 5 — Touch & Input

Field Default Description
Grab Cursor On Shows a hand cursor when dragging on desktop
Touch on Desktop On Allows mouse drag to simulate touch
Swipe Threshold 5 px Minimum drag distance to register a swipe
Long Swipes On Long swipe gestures advance the slider
Edge Resistance On Drag resistance at the first and last slide

Image presets (required config)

The snippet serves responsive images with Kirby's native srcset(), generating webp crops in two orientations. Because Kirby plugins can't register global thumbs.presets / thumbs.srcsets, you must add these to your site's site/config/config.php — the snippet reads them by name:

How it maps to the Panel:

The descriptor keys (640w, 900w, …) must be valid srcset width descriptors — Kirby uses them verbatim in the generated srcset attribute. Keep the names swiper-horiz, swiper-vert, swiper-lqip-horiz, swiper-lqip-vert exactly, since the snippet looks them up by name.

Thumbs are generated on demand by Kirby's media manager and cached under /media.


Manual asset loading

By default the snippet injects Swiper's CDN links at the point the block is rendered in the page body. For performance-sensitive sites you may want to place them in <head> instead. Add this to your head snippet:

And before </body>:

Then suppress auto-injection in site/config/config.php:

Slider height & avoiding collapse

Swiper containers have no intrinsic height — a slider whose slides have nothing to give them height collapses to zero. This block handles that for you in two ways, both applied automatically to the .swiper-block parent <div> via an inline CSS custom property (no template or layout-class changes required):

You no longer need to add custom classes to your layout field to give the slider a height — set Slider Height in the Layout tab instead. The plugin's CSS reads the value from the parent .swiper-block element, so per-block height control lives entirely in the Panel.


For plugin developers

Node is only required if you are modifying the Panel editor component (src/SwiperBlock.vue). The frontend JS (assets/js/swiper-block.js) is plain hand-authored JavaScript — no build step needed.

Panel build

The bundle is built with kirbyup, Kirby's official Panel plugin bundler — it compiles against the Panel's own Vue 2.7 runtime, and Kirby auto-loads index.js / index.css from the plugin root.

Deployment

Commit the compiled Panel output alongside your source changes:

Kirby will never see .vue files on the live server — only the pre-compiled index.js.


License

MIT © Ian Hobbs


All versions of kirby-swiper-block with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
getkirby/composer-installer Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ianhobbs/kirby-swiper-block contains the following files

Loading the files please wait ...