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

Media Field Type Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

Implementation Patterns

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.

Gotchas and Tips

  • Abandonware risk. Zero stars, zero dependents, and a 2022 release means no security or compatibility patches. Pin the version, fork it internally if you rely on it, and re-test on every Streams Platform upgrade.
  • Orphaned files. Deleting an entry or detaching a file rarely deletes the underlying file. Schedule cleanup or hook into entry-deleted events to avoid storage creep.
  • Null presenters. Always guard with @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."
  • Config drift. If the config schema changed across releases, blueprints created on an older version may have unknown keys that silently do nothing. Re-save fields after upgrades and verify the input view honors your config.
  • Storage disk dependence. Uploads go through the files module, so failures usually trace to filesystems.php disk config, permissions, or a mismatched files-module version—not this addon. Debug there first.
  • Multiple-media semantics. Single-file and folder/multiple modes behave differently in the presenter and in raw values. Normalize in your output partial instead of scattering is_array checks through views.
  • Extension points. The field type class and its presenter are the override surface. Subclass the presenter or bind a replacement in a service provider if you need custom URL logic; override the published config/view if you need UI changes, rather than editing vendor files.
  • Debugging. dd($entry->field) shows the presenter, not the raw ID—use $entry->getFieldValue('hero_image') when you actually need the stored value.
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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle