Weave 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

Slider Field Type Laravel Package

anomaly/slider-field_type

Anomaly Slider Field Type provides a configurable slider input for Streams Platform forms and entries, letting editors select numeric values with defined range and step settings. It integrates smoothly into Laravel/PHP projects built on Anomaly CMS.

View on GitHub
Deep Wiki
Context7

Getting Started

anomaly/slider-field_type is a Streams Platform field type addon, not a standalone slider library. It registers a "Slider" field type in the control panel so you can assign a range/step widget to a stream field. If you are not running PyroCMS / Streams, this package is not useful to you — the real dependency is anomaly/streams-platform.

Install with Composer and let addon discovery pick it up:

composer require anomaly/slider-field_type
php artisan addon:publish   # publish views/assets if the addon ships them

Look here first:

Path Why
src/SliderFieldType.php The field type class; $inputView, defaults, and validation live here
resources/views/input.twig The actual <input type="range"> / JS widget markup
resources/config/config.php or config/ Default min, max, step, unit/suffix keys
lang/en/addon.php Name/description shown in the admin type picker

First use case: in the control panel, open a stream → Fields → Assign Field, choose Slider, and set min/max/step in the field config. The stored value comes back as a plain number on the entry.

Implementation Patterns

Assigning the field in the admin

Preferred for one-off streams. The field config block (min, max, step, default) is persisted as JSON on the field assignment, so different streams can use the same field type with different ranges without touching code.

Assigning the field programmatically

For repeatable deploys, define the field on the stream/migration so it's versioned:

protected $fields = [
    'priority' => [
        'type'   => 'anomaly.field_type.slider',
        'config' => [
            'min'  => 0,
            'max'  => 10,
            'step' => 1,
        ],
    ],
];

If you prefer explicit calls, $stream->getAssignment('priority') / the FieldsRepository can be used to add the assignment in a seeder.

Reading and writing the value

The value is a scalar, so treat it like any numeric attribute:

$entry->priority = 7;
$entry->save();

echo $entry->priority; // 7

In Twig:

<span class="badge">{{ entry.priority }}/10</span>

{# Simple star rendering from a 1–5 slider #}
{% for i in 1..5 %}
    <i class="fa fa-star{{ i <= entry.rating ? '' : '-o' }}"></i>
{% endfor %}

Using it in custom forms

Because it's a field type, it works anywhere Streams builds a form — the stream form, a custom module form that declares the field, or the FormBuilder:

$form->add('satisfaction', 'anomaly.field_type.slider', [
    'config' => ['min' => 0, 'max' => 5, 'step' => 1],
]);

Display-time interpretation

Store the raw number and convert on read rather than storing display strings. Keep the slider as the input control and put labels ("Low/Medium/High") in Twig or a view presenter — the field type only knows about numbers.

Gotchas and Tips

  • Version-pin Streams. This is a 1-star, effectively unmaintained addon. Lock both the addon and anomaly/streams-platform in composer.json and commit your composer.lock. Expect the addon to lag behind platform releases.
  • Client-side range ≠ validation. A min/max on a range input is trivially bypassed. Add server-side rules on the field assignment or in the form definition ('rules' => ['integer', 'between:0,10']); don't rely on the widget.
  • Config types are strings. Values coming out of the field config JSON are often "0", "10" — cast with (int) / (float) before comparing or doing math, and be careful with step when it's 0.1 (float drift on decimals).
  • Empty vs zero. If the column is nullable, an untouched slider may save null or 0 depending on the view's default handling. Decide early and normalize in an accessor/mutator or a saving hook to avoid 0 masquerading as "not set".
  • Decimal storage. If you set step => 0.1, make sure the underlying column is decimal/float, not integer, or you'll silently truncate.
  • Assets and view namespace. The input view is registered under the addon namespace (anomaly.field_type.slider::input). If the widget renders unstyled, run php artisan addon:publish and check that the associated JS/CSS is registered on the field type — a missing asset is the usual cause.
  • Debugging the view path. Override $inputView in a subclass, or use view:clear after editing the Twig file. If nothing renders, confirm the addon was discovered (php artisan addon:list) — composer type: streams-addon is what triggers registration.
  • Extension point: the cleanest way to add labels, units, or a custom widget is to extend SliderFieldType, override getInputView() / getConfig(), and register your subclass as its own addon rather than editing vendor files. Never patch the package in vendor/.
  • Vendor it if you depend on it. With zero dependents and no recent activity, plan to fork the addon into your own namespace if you need bug fixes or Twig/Streams upgrades; it's small enough that maintaining a fork is realistic.
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.
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource