PHPackages                             becklyn/video-platforms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. becklyn/video-platforms

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

becklyn/video-platforms
=======================

Several helpers for integrating video tools in your Symfony application.

2.1.0(4y ago)27.0k↓71.4%BSD-3-ClausePHPPHP &gt;=7.4CI failing

Since May 14Pushed 4y ago2 watchersCompare

[ Source](https://github.com/Becklyn/video-platforms)[ Packagist](https://packagist.org/packages/becklyn/video-platforms)[ Docs](https://github.com/Becklyn/video-platforms)[ RSS](/packages/becklyn-video-platforms/feed)WikiDiscussions 2.x Synced today

READMEChangelog (5)Dependencies (7)Versions (6)Used By (0)

Video Platforms Bundle
======================

[](#video-platforms-bundle)

Several helpers for integrating video tools in your Symfony application.

Installation
------------

[](#installation)

```
composer require becklyn/video-platforms
```

Usage
-----

[](#usage)

### Parsing an URL

[](#parsing-an-url)

```
use Becklyn\VideoPlatforms\Parser\VideoUrlParser;

function parse (VideoUrlParser $parser, string $videoUrl)
{
    $video = $parser->parse($videoUrl);
}
```

### Storage

[](#storage)

Any video will be stored as normalized array, and can be recreated from it. See below "Usage in entities" for more information.

There is also a simple string-based serialization, although you will lose the initial format:

```
use Becklyn\VideoPlatforms\Video\Video;

$video = new Video("youtube", "123");

assert("youtube@123" === $video->serialize());
```

The internal format is `@`. That can easily be stored in the database.

To unserialize, just use

```
use Becklyn\VideoPlatforms\Video\Video;

$serialized = "youtube@123";
$video = Video::unserialize($serialized);

assert("youtube" === $video->getPlatform());
assert("123" === $video->getId());
// will be autogenerate
assert("youtube@123" === $video->getUrl());
```

### Usage in entities

[](#usage-in-entities)

Your entity should look something like this:

```
use Becklyn\VideoPlatforms\Validation\Constraint\VideoUrl;
use Becklyn\VideoPlatforms\Video\Video;

class MyEntity
{
    /**
     * @ORM\Column(name="video", type="json")
     *
     * @VideoUrl(platforms={"vimeo"})
     * @Assert\NotNull()
     */
     private ?array $video = null;

    /**
     */
    public function getVideo () : ?Video
    {
        return Video::createFromArray($this->video);
    }

    /**
     */
    public function setVideoUrl (?Video $video) : void
    {
        $this->video = null !== $video
            ? $video->toArray()
            : null;
    }
}
```

### Usage in Forms

[](#usage-in-forms)

In your form you should use the `VideoUrlType`:

```
use Becklyn\VideoPlatforms\Form\Type\VideoUrlType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class MyForm extends AbstractType
{
    /**
     * @inheritDoc
     */
    public function buildForm (FormBuilderInterface $builder, array $options) : void
    {
        parent::buildForm($builder, $options);

        $builder
            ->add("video", VideoUrlType::class, [
                "label" => "video.label",
                "required" => true,
            ]);
    }
}
```

> **Tip:**
>
> When entering the value in a form field, you can always use the string-serialized version, to avoid parsing clashes. So just enter `vimeo@123` for example.

### Validation

[](#validation)

You can use the `@VideoUrl()` annotation on any property.

```
/**
 * @VideoUrl()
 */
```

You can also define which platforms you want to allow. Use the platform key:

```
/**
 * @VideoUrl(platforms={"vimeo"})
 */
```

### Registering a custom platform

[](#registering-a-custom-platform)

Implement the `VideoUrlParserInterface` and either use autoconfiguration or add the DI tag `becklyn.video-platforms.parser`.

### Supported Formats

[](#supported-formats)

#### Vimeo

[](#vimeo)

- `123456789` (plain id, watch out for clashes)
- `https://vimeo.com/123456789`

#### YouTube

[](#youtube)

- `_1234567890` (plain id, watch out for clashes)
- `https://www.youtube.com/watch?v=_1234567890`
- `https://www.youtube.com/v/_1234567890`
- `https://youtu.be/_1234567890`
- `https://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D_1234567890&format=json`
- `https://youtube.com/embed/_1234567890`
- `https://www.youtube.com/attribution_link?a=sgsfg&u=%2Fwatch%3Fv%3D_1234567890%26feature%3Dem-uploademail`

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity60

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~128 days

Recently: every ~161 days

Total

6

Last Release

1597d ago

Major Versions

1.0.0 → 2.0.02020-05-15

PHP version history (2 changes)1.0.0PHP ^7.4

2.1.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1044355?v=4)[Becklyn Studios](/maintainers/becklyn)[@Becklyn](https://github.com/Becklyn)

### Embed Badge

![Health badge](/badges/becklyn-video-platforms/health.svg)

```
[![Health](https://phpackages.com/badges/becklyn-video-platforms/health.svg)](https://phpackages.com/packages/becklyn-video-platforms)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M386](/packages/easycorp-easyadmin-bundle)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M339](/packages/api-platform-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k17.8k](/packages/prestashop-prestashop)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
