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

Integer Field Type Laravel Package

visiosoft/integer-field_type

An integer field type addon for Visiosoft Streams that adds whole-number fields to Laravel-powered CMS entries, forms, and modules. Configure and store numeric values with a simple, lightweight integration designed for Streams Platform projects.

View on GitHub
Deep Wiki
Context7

Getting Started

This is not a standalone Laravel package — it is a Streams Platform (PyroCMS 3) field type addon. It will do nothing in a plain Laravel app. Confirm first that your project already pulls in anomaly/streams-platform (or a Visiosoft/OpenClassify distribution) before installing.

Minimal steps:

  1. composer require visiosoft/integer-field-type (check whether your app expects the openclassify/integer-field_type fork — they are the same addon lineage; do not install both).
  2. Let the addon service provider register (Streams addons are discovered via the package's composer.json / extra metadata). If discovery is disabled in your install, register Visiosoft\IntegerFieldType\IntegerFieldTypeServiceProvider manually.
  3. Rebuild caches so the field type is known to the platform (php artisan streams:compile, then php artisan view:clear).
  4. Attach it to a stream — either through the admin UI (Fields → New Field → choose the integer type) or in a migration/seed:
$stream->addField('stock', 'integer', [
    'required' => true,
]);

Where to look first:

  • src/IntegerFieldTypeServiceProvider.php — registration, config merging, view namespace.
  • src/IntegerFieldType.php — the field type class: $inputView, $presenter, $modifier, rules, config defaults.
  • resources/views/ — the Twig input partial actually rendered in forms.
  • resources/config/settings.php (if present) — per-field configurable options.
  • resources/lang/en/addon.php — the name/description shown in the field picker.

First realistic use case: a numeric attribute on a stream entry (quantity, sort order, year, external ID) that you want validated as a whole number in the admin form and cast to int when read back from the entry model.

Implementation Patterns

Declaring fields in migrations/seeders. The normal day-to-day path is addField() on a stream assignment. Use the field type slug (integer) rather than the class name. Assignments belong to a stream, so create the stream first, then add the field, then the namespace/stream is ready for entries.

Per-field configuration. Streams field types expose options through config (commonly min, max, default, step, and sometimes pattern). Set them in the third argument of addField() or in the admin field form. Keep validation in config rather than scattered in controllers — the field type's getRules() is where the platform reads them during form submission.

Reads and writes through the entry model. On the Eloquent side the attribute comes back as the stored column value. If you use a presenter for display, that is where you format (thousands separators, suffix). Keep the raw accessor numeric for calculations and comparisons; format only at render time.

Frontend forms (Twig). Once the field is on a stream and the form builder includes it, {{ form.fields.stock }} (or the generated field set) renders the addon's input view. To customise the markup, publish/override the view under your theme's resources/views with the same namespace path rather than editing the vendor copy.

API / programmatic writes. Treat it like any integer column: cast before saving if you are going through a repository that does not run form validation ($entry->stock = (int) $request->input('stock')). Validation rules from the field type only run in the Streams form flow, not in arbitrary Eloquent saves.

Querying and sorting. For sortable/admin lists, use the standard Streams criteria/query builder against the column; integer comparison is straightforward, but remember nulls sort differently across drivers.

Extending. Two common extension points: subclass the field type and override getRules()/getConfig() (then register your subclass in your own addon), or override the Twig input view. For one-off validation needs, prefer a custom rule in the field config over forking the package.

Gotchas and Tips

  • Ecosystem coupling is the big one. This only works inside Streams/PyroCMS. If you are on a newer Streams version than the 2020 release targets, expect API drift — check the platform's FieldType base class methods (getRules, getConfig, getModifier, getPresenter) still match what this addon calls.
  • Maintenance risk. Zero stars, single release in 2020, no dependents listed. Before adopting, diff it against the field type shipped with your Streams version — often the built-in integer type already covers the need and you can skip the dependency entirely.
  • Two forks, one namespace. visiosoft/integer-field_type and openclassify/integer-field_type share the same class namespace. Composer may resolve both without complaint while the platform registers a duplicate/wrong provider. Check composer show and your compiled addons list if the field picker behaves oddly.
  • Request input is a string. Form submissions arrive as "42", not 42. Any === 0 or is_int() check downstream will fail. Cast at the boundary.
  • 0 vs empty. Required validation plus a 0 value is a classic false-negative if any custom code uses empty(). Use is_null()/strict checks. Same trap for nullable fields where 0 and null must be distinguished in the DB.
  • min/max are validation, not schema. They will not produce a DB constraint or an unsigned column. Add the column-level guarantees yourself if the data matters (e.g. a separate migration or stream config), especially for negative/leading-zero edge cases.
  • Caching. After any addon change: php artisan streams:compile, php artisan view:clear, and if you use a compiled addon manifest, clear it. Most "field type not found" reports are stale cache, not broken code.
  • Debugging tips. If the input does not render, check the addon appears in php artisan addon:list (or your platform's equivalent), that the field assignment exists on the stream, and that the Twig namespace from the service provider is registered. Log the field type class name from the assignment to confirm the slug resolved to this addon.
  • Display formatting vs storage. Do not let a presenter write formatted strings back into the model; keep formatting in the presenter/view and numeric values in the attribute. Mixed types will break ordering and range queries.
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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
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
cgv/localized-resource