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

Video Field Type Laravel Package

anomaly/video-field_type

Anomaly Video Field Type adds a video upload and management field to PyroCMS and Laravel Streams, letting you attach and display video files on entries with minimal configuration.

View on GitHub
Deep Wiki
Context7

Getting Started

anomaly/video-field_type is a Streams Platform field type that adds a "video" input to any stream in PyroCMS. It is an addon, not a standalone library — it does nothing until it is installed into a Streams/PyroCMS application and assigned to a stream.

Minimal steps:

composer require anomaly/video-field_type
php artisan addon:install anomaly.video_field_type

Where to look first, in order:

  1. src/VideoFieldType.php — the field type class; shows the slug (anomaly.field_type.video), validation rules, and input/view wiring.
  2. src/VideoFieldTypePresenter.php — the developer-facing API you will call from Twig/Blade.
  3. resources/views/ — the input and (if present) decorated output views.
  4. resources/lang/ — labels/placeholders you will want to override.
  5. src/VideoFieldTypeServiceProvider.php — bindings, routes, and any registerable hooks.

First use case — add a video field to a stream via a migration/seeder rather than the control panel, so it ships with your module:

use Anomaly\Streams\Platform\Database\Migration\Migration;

class CreateProductsStream extends Migration
{
    protected $stream = [
        'slug' => 'products',
    ];

    protected $assignments = [
        'name'         => ['type' => 'anomaly.field_type.text', 'required' => true],
        'promo_video'  => ['type' => 'anomaly.field_type.video'],
    ];
}

Then render it in a Twig view:

{% if entry.promo_video.value %}
    <h3>Watch the demo</h3>
    {{ entry.promo_video.embed|raw }}
{% endif %}

If you are not sure what the presenter offers, run php artisan tinker and dd($entry->promo_video->getPresenter()) or open VideoFieldTypePresenter.php directly — the package is small enough to read end to end in ten minutes.

Implementation Patterns

Assigning the field. Three common routes:

  • Control panel: Streams → your stream → Assignments → New Field → type "Video".
  • Migration $assignments (above) — preferred because it is reproducible.
  • Programmatic assignment at runtime for dynamic schemas:
$stream = Streams::make('products.products');
$stream->addField('promo_video', 'anomaly.field_type.video');

Rendering. Always go through the presenter, not the raw column, so URL parsing/provider detection is applied consistently:

{# Twig #}
{{ entry.promo_video }}                 {# raw stored value #}
{{ entry.promo_video.embed|raw }}       {# embed markup, if supported #}
{{ entry.promo_video.value }}           {# underlying value #}
// Blade / PHP
$value   = $entry->promo_video->value;
$embed   = $entry->promo_video->embed();   // check presenter for exact signature

Forms. In module form builders, reference the type directly so the same input widget is reused:

protected $fields = [
    'promo_video' => [
        'type'     => 'anomaly.field_type.video',
        'required' => false,
        'instructions' => 'Paste a YouTube or Vimeo link.',
    ],
];

Validation. Because the field ultimately stores a string, add your own provider-aware rule in the form request or the stream field's rules:

'promo_video' => 'nullable|url',

Extending. Two clean extension points:

  • A custom presenter/modifier class registered on the field type (subclass VideoFieldType and override getPresenter() / getModifier()).
  • View overrides: publish or mirror resources/views/input.twig into your addon's resources/views to restyle the widget without touching vendor code.

Querying. The value lives in the stream's translated/untranslated table as a normal column. Search, filter, and sort via the repository as you would any string field:

$products = $products->where('promo_video', '!=', null)->get();

Gotchas and Tips

  • This package is effectively unmaintained. Zero stars, zero dependents, last activity long ago. Pin it ("anomaly/video-field_type": "1.*"), and if you rely on it for production, fork it into your own VCS so a Packagist outage or a Laravel constraint bump cannot break installs.
  • Laravel version ceilings. Streams 1.x-era addons commonly cap at Laravel 5.x. Composer will happily resolve to something that fails at runtime — check composer.json require before upgrading your app.
  • The type slug is anomaly.field_type.video, not video. A typo in $assignments produces a confusing "field type not found" during migration; the addon must also be installed before the migration runs.
  • Empty values are not null-safe in presenters. $entry->promo_video->embed() on an empty field will often throw or return garbage. Guard with if ($entry->promo_video->value) in Twig/PHP.
  • Escape carefully. Embed markup must be output with |raw in Twig; the raw value should not be. If the field only stores a URL, build your own embed in the view rather than trusting presenter output.
  • Do not assume provider validation. The field type typically accepts any string/URL. If you need YouTube/Vimeo-only, add a regex or custom rule — otherwise editors will paste broken links.
  • Caching. Streams caches stream/field definitions. After editing $assignments or the addon's config, run php artisan cache:clear (and re-run the migration), or the control panel will keep showing the old field.
  • Debugging tip. When a field renders blank, check in this order: assignment exists (Streams::make('ns.slug')->getAssignment('promo_video')), addon registered (php artisan addon:list), presenter value non-empty, then the view.
  • Translations and labels live in resources/lang/en/addon.php and field_type.php; override them in your own addon's language files rather than editing vendor files so updates remain safe.
  • Extension points to prefer: subclass the field type for custom presenter behavior, and override views for markup. Avoid patching vendor/ — Streams addons are re-published on install and your changes will be lost.
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.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core