Download the PHP package shallowred/kirby-collection-manager without Composer
On this page you can find all versions of the php package shallowred/kirby-collection-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shallowred/kirby-collection-manager
More information about shallowred/kirby-collection-manager
Files in shallowred/kirby-collection-manager
Package kirby-collection-manager
Short Description A powerful Kirby CMS plugin for managing collections with AJAX pagination, search, filtering, and sorting. Provides both complete out-of-the-box solution and flexible components for custom implementations.
License MIT
Homepage https://github.com/ShallowRed/kirby-collection-manager
Informations about the package kirby-collection-manager
Kirby Collection Manager
AJAX-powered collection listings for Kirby CMS: search, filters, sorting and pagination, rendered server-side and enhanced with htmx. Works without JavaScript, supports several independent collections on the same page, and ships with sensible default snippets you can override.
Installation
Requires PHP 8.1+ and Kirby 4 or 5.
Quick start
The plugin follows Kirby's controller/template split. In a controller (page
controller, snippet controller or block controller), hand your collection to
CollectionController::handle():
Then render the wrapper snippet in the template:
That's it: search form, filter pills, paginated items — with AJAX swaps when JavaScript is available, plain links and form submits when it is not.
There is also a shorthand page method:
Configuration
All keys are optional; defaults shown below.
Visitor-facing sorting
Offer sort options with the field:direction syntax (direction defaults to
sorting.direction). Requested values are validated against this whitelist.
Multi-select filters
Set 'multiple' => true on a taxonomy to let visitors combine values. Options
toggle in and out of a comma-separated param (?category=Design,Engineering)
and items match when any of their values match.
Several collections on one page
Give each instance its own pagination param — everything else (fragment targeting, URL generation) is scoped automatically:
Custom item template
Point snippets.item to your own snippet; it receives $item (the page),
$orderIndex and $config:
Any other snippet (search, filters, pagination, sorting, indicator, wrapper)
can be overridden the same way, or globally by creating a snippet with the
same name in site/snippets/.
Styling
Three levels of customization, from lightest to fullest. They compose freely.
1. Default stylesheet + CSS variables
Enable the bundled stylesheet (injected once, however many instances):
Or include it manually:
The whole file lives in the collection-manager cascade layer,
so any rule in your own stylesheet overrides it — no specificity fights.
Theme it by overriding the --cm-* variables:
Dark mode follows prefers-color-scheme automatically, or force it with a
.cm-dark class (also honors [data-theme="dark"]).
All CSS variables
| Variable | Default | Purpose | |----------|---------|---------| | `--cm-color-primary` | `#333` | Main text | | `--cm-color-secondary` | `#6c757d` | Muted text | | `--cm-color-border` | `#ddd` | Borders | | `--cm-color-bg` | `#fff` | Surfaces | | `--cm-color-bg-hover` | `#f5f5f5` | Hover surfaces | | `--cm-color-bg-muted` | `#f8f9fa` | Muted surfaces (pills, buttons) | | `--cm-color-bg-active` | `#007bff` | Active filter / current page | | `--cm-color-text-on-active` | `#fff` | Text on active background | | `--cm-color-link` / `--cm-color-link-hover` | `#007bff` / `#0056b3` | Links | | `--cm-color-danger` | `#dc3545` | Clear-filters link | | `--cm-color-info-bg` | `#e3f2fd` | "Searching for" banner | | `--cm-color-shadow` | `rgba(0,0,0,.1)` | Card hover shadow | | `--cm-spacing-xs/sm/md/lg/xl` | `.25/.5/1/1.5/2rem` | Spacing scale | | `--cm-font-size-sm/base/lg` | `.875/1/1.125rem` | Type scale | | `--cm-border-radius-sm/md/pill` | `4px/8px/20px` | Radii | | `--cm-transition-fast/normal` | `.15s/.2s ease` | Transitions | | `--cm-search-max-width` | `400px` | Search field width | | `--cm-item-image-height` | `200px` | Card image height | | `--cm-pagination-button-size` | `2.5rem` | Pagination buttons | | `--cm-grid-min-width` | `280px` | Items grid min column |2. Custom classes (Tailwind / UnoCSS / DaisyUI)
The classes config appends your utility classes to every element the plugin
renders — the default BEM classes stay in place, so behavior, tests and the
default stylesheet keep working:
Available keys: wrapper, search, searchInput, searchSubmit,
searchClear, filters, filterGroup, filterLabel, filter,
filterActive, filtersClear, sorting, sortingLabel, sortingSelect,
items, item, empty, pagination, paginationItem, paginationIcon,
indicator.
3. Custom snippets
For full control over the markup, override any snippet (see below).
How the AJAX layer works
The wrapper snippet loads a bundled htmx (once per page, however many
instances there are) and every control targets the instance's content
element. The server detects fragment requests through the HX-Target header,
so URLs stay clean and shareable — a reload of any URL renders the full page.
Fragment responses send Vary: HX-Target for cache correctness. Out-of-range
page numbers (e.g. a stale link to page 3 of a filtered list) are clamped to
the nearest valid page instead of erroring.
Translations
English, French and German are built in. Override or add languages in your config:
Demo & tests
A demo site lives in demo/ (requires a Kirby core in demo/kirby, not
versioned). The Playwright end-to-end suite runs against it:
PHP linting: composer lint.
License
MIT
All versions of kirby-collection-manager with dependencies
getkirby/composer-installer Version ^1.1
lukaskleinschmidt/kirby-snippet-controller Version ^2.2