visiosoft/media-field_type
A media field type for Visiosoft and PyroCMS Streams that adds file and image upload/selection to custom fields. Easily attach media to entries through a simple, integrated field type with minimal setup.
Confirm the actual composer name before anything else—this addon uses the Streams Platform naming convention, so it is likely visiosoft/field_type.media (the GitHub repo name and composer name do not always match). Run composer require visiosoft/field_type.media or add it as a path repository during local development, then install the addon:
php artisan addon:install visiosoft.field_type.media
First place to look is src/MediaFieldType.php and the resources/ directory. Those tell you the field type slug, the input view namespace, and the config schema the blueprint editor will expose. Check composer.json for the required anomaly/streams-platform and files-module versions—this package is old enough (last release 2022-08-08) that the constraint is your first compatibility checkpoint.
The first use case is almost always: add a "Media" field to an existing stream (a page, listing, product, or user profile), upload through the admin form, and render the result in a Blade view. Create the field from the control panel under Streams → Fields (or in a migration), assign it to a stream via Assignments, then reload the entry form to see the upload/browse widget.
Blueprint / migration assignment. Declare the field with config so behavior is reproducible across environments:
$this->fieldType('hero_image', 'visiosoft.field_type.media', [
'mode' => 'single', // or folder/multiple depending on version
'allowed_types' => 'image/*',
'max_size' => 2048,
]);
Rendering in Blade. Field types return a presenter, so access the attachment through it rather than touching the raw value:
@if($entry->hero_image)
<img src="{{ $entry->hero_image->url() }}" alt="{{ $entry->name }}">
@endif
Inspect the presenter class in src/ for the exact accessor names (url(), path(), thumbnail(), image()), since these vary between releases and the README may lag.
Programmatic attachment. For seeders or imports, resolve the files-module repository and assign the resulting file ID to the field before saving the entry. Save the entry after the file exists—assigning a stale or null ID is the most common cause of "field silently empty" bugs.
Form/Table Builder integration. Because it is a standard Streams field type, it plugs into FormBuilder and TableBuilder without extra wiring. Use the table builder's field configuration to pick a sensible view (thumbnail vs. filename) rather than rendering raw IDs.
Shared partial for output. Wrap media rendering in a component or Blade include that handles null, missing files, and different mime types, so every stream consumes it consistently.
@if($entry->field)—presenters can still render empty strings or throw if the file record was removed out-of-band. Handle both "no field value" and "value points to missing file."filesystems.php disk config, permissions, or a mismatched files-module version—not this addon. Debug there first.is_array checks through views.dd($entry->field) shows the presenter, not the raw ID—use $entry->getFieldValue('hero_image') when you actually need the stored value.How can I help you explore Laravel packages today?