Weave Code
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 Platforms

Video Platforms Laravel Package

becklyn/video-platforms

Symfony bundle providing helpers to parse and normalize video URLs (YouTube/Vimeo etc.), serialize/store as “platform@id” or arrays, validate via constraints, and integrate with entities and forms using a VideoUrlType.

View on GitHub
Deep Wiki
Context7

Several helpers for integrating video tools in your Symfony application.

Frequently asked questions about Video Platforms
Can I use this package directly in Laravel without Symfony dependencies?
No, this package is Symfony-centric and relies on Symfony components like `symfony/validator` and `symfony/form`. For Laravel, you’d need to create adapters (e.g., facades or custom validation rules) to wrap its core logic, replacing Symfony-specific parts with Laravel equivalents like Form Requests or custom validation rules.
How do I parse and store video URLs in Laravel using this package?
You can use the `VideoUrlParser` to parse URLs into a normalized format like `youtube@123`. Store the result as a JSON array in Eloquent or as a string (e.g., `youtube@123`) in a database column. The `Video` class provides `serialize()` and `unserialize()` methods for easy conversion.
Does this package support Laravel’s Eloquent ORM for video storage?
Yes, the package’s storage format (`platform@id` or JSON arrays) works seamlessly with Eloquent. You can store the serialized video data in a JSON column or as a string, then reconstruct it using `Video::unserialize()` or `Video::createFromArray()` in your model.
How do I validate video URLs in Laravel if this package uses Symfony constraints?
You’ll need to create a custom Laravel validation rule (e.g., `VideoUrlRule`) that replicates the Symfony `@VideoUrl` constraint logic. This rule can check if a URL matches supported platforms (YouTube, Vimeo, etc.) and throw validation errors for invalid formats.
Is there a Laravel equivalent to Symfony’s `VideoUrlType` for forms?
No, but you can build a custom Laravel form component (e.g., using Livewire, Inertia.js, or a Form Request) to handle video URL input. The component would parse user input into the `platform@id` format and validate it using your custom Laravel validation rule.
What Laravel versions does this package support?
This package is Symfony-focused and doesn’t officially support Laravel. However, you can adapt its core parsing and validation logic for Laravel 8+ or 9+ by abstracting Symfony dependencies. Test thoroughly, as compatibility depends on your custom adapter layer.
Can I extend this package to support additional video platforms like TikTok or Twitch?
Yes, the package’s design allows registering custom platforms via `VideoPlatformInterface`. In Laravel, you’d implement this interface and register your new platform in a service provider or package config, then ensure your custom validation rules and parsers handle the new format.
Are there performance concerns using Symfony components in a Laravel app?
Minimal overhead exists if you only use standalone Symfony components (e.g., `symfony/validator`) via Composer. However, avoid pulling in heavy Symfony bundles. For best performance, prefer Laravel-native alternatives (e.g., built-in validation) unless you specifically need Symfony’s parsing logic.
What alternatives exist for video URL handling in Laravel?
Consider Spatie’s `laravel-media-library` for media management or custom solutions using Laravel’s validation rules + manual URL parsing. For lightweight needs, a simple regex-based validator combined with Eloquent JSON columns may suffice without external dependencies.
How do I handle testing for video URL parsing in Laravel?
Write PHPUnit tests for your custom adapters (e.g., `VideoUrlParserAdapter`) and validation rules. Test edge cases like malformed URLs, unsupported platforms, and serialization/deserialization. Mock Symfony dependencies if needed, but focus on Laravel-specific integration points like Eloquent models and form handling.
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.
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php
trappistes/laravel-custom-fields
splash/sonata-admin
splash/metadata