WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 270d304

Browse files
committed
Hello world :)
0 parents  commit 270d304

21 files changed

+14264
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
/.php-cs-fixer.php
3+
/.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder)
4+
->in(__DIR__)
5+
->exclude(['tests']);
6+
7+
$config = new PhpCsFixer\Config();
8+
$config->setRiskyAllowed(true)
9+
->setRules([
10+
'@Symfony' => true,
11+
'array_syntax' => ['syntax' => 'short'],
12+
'class_definition' => false,
13+
'concat_space' => ['spacing' => 'one'],
14+
'ordered_imports' => true,
15+
'native_function_invocation' => [
16+
'include' => [],
17+
],
18+
'trailing_comma_in_multiline' => false,
19+
])
20+
->setFinder($finder);
21+
22+
return $config;

.phpunit.result.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":1,"defects":{"Robole\\SuluVideoBundle\\Tests\\VideoTwigExtensionTest::testGetVideoEmbedUrl":7},"times":{"HelloWorldTest::testHelloWorld":0.004,"Robole\\SuluVideoBundle\\Tests\\VideoTwigExtensionTest::testGetVideoEmbedUrl":0.005,"Robole\\SuluVideoBundle\\Tests\\VideoTwigExtensionTest::testGetVideoProvider":0}}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 robole - Kabisch & Wilmer GbR
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
![GitHub release](https://flat.badgen.net/github/release/robole-dev/SuluVideoBundle)
2+
![Supports Sulu 2.6 or later](https://flat.badgen.net/badge/Sulu/2.6/52B5C9?icon=php)
3+
4+
# SuluVideoBundle
5+
6+
> Sulu CMS bundle to preview and extract embed URLs from Youtube, Vimeo, Dailymotion and HTML5 videos.
7+
8+
This bundle adds a new content type `video` and provides the Twig functions `video_provider` and `video_embed_url` to embed external videos in an `iframe` or `video` element.
9+
10+
![Demonstration of video content type](cover.png)
11+
12+
## Installation
13+
14+
This bundle requires PHP 8.2 or later and [Node 18](https://nodejs.org/en/) (or Node 14 for Sulu versions <2.6.0) for building the Sulu administration UI.
15+
16+
1. Open a command console, enter your project directory and run:
17+
18+
```console
19+
composer require robole/sulu-video-bundle
20+
```
21+
22+
If you're **not** using Symfony Flex, you'll also need to add the bundle in your `config/bundles.php` file:
23+
24+
```php
25+
return [
26+
//...
27+
Robole\SuluVideoBundle\SuluVideoBundle::class => ['all' => true],
28+
];
29+
```
30+
31+
2. Link the frontend code by adding the following to your `assets/admin/package.json`:
32+
33+
```json
34+
"dependencies": {
35+
"sulu-video-bundle": "file:../../vendor/robole/sulu-video-bundle/src/Resources/js"
36+
}
37+
```
38+
39+
3. Import the frontend code by adding the following to your `assets/admin/app.js`:
40+
41+
```javascript
42+
import "sulu-video-bundle";
43+
```
44+
45+
4. Install all npm dependencies and build the admin UI ([see all options](https://docs.sulu.io/en/2.5/cookbook/build-admin-frontend.html):
46+
47+
```bash
48+
cd assets/admin
49+
npm install
50+
npm run build
51+
```
52+
53+
## Usage
54+
55+
1. Add the `video` content type to any of your page templates:
56+
57+
```xml
58+
<property name="my_video" type="video" mandatory="true">
59+
<meta>
60+
<title lang="de">Video</title>
61+
<title lang="en">Video</title>
62+
</meta>
63+
</property>
64+
```
65+
66+
2. Render the embeddable link in your twig templates:
67+
68+
```twig
69+
{% if content['my_video'] %}
70+
{% if video_provider(content['my_video']) %}
71+
<!-- YouTube, Vimeo or Dailymotion -->
72+
<iframe
73+
src="{{ video_embed_url(content['my_video']) }}"
74+
frameborder="0"
75+
allow="fullscreen"
76+
></iframe>
77+
{% else %}
78+
<!-- HTML5 video -->
79+
<video
80+
controls
81+
src="{{ video_embed_url(content['my_video']) }}"
82+
></video>
83+
{% endif %}
84+
{% endif %}
85+
```
86+
87+
### Background
88+
89+
This small bundle serves as a reference for our blog series ["Sulu Bundle Development"](https://robole.de/blog/sulu-bundle-development-part-1) showcasing major steps to build a Sulu bundle from scratch. The underlying idea was inspired by the [Statamic Video Fieldtype](https://statamic.dev/fieldtypes/video).
90+
91+
### Scripts
92+
93+
- To test the PHP code, run:
94+
95+
> composer phpunit
96+
97+
- To check the coding standards, run:
98+
99+
> composer php-cs
100+
101+
- To apply coding standards, run:
102+
> composer php-cs-fix

composer.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "robole/sulu-video-bundle",
3+
"description": "Preview, extract and embed videos in Sulu CMS",
4+
"type": "symfony-bundle",
5+
"license": "MIT",
6+
"autoload": {
7+
"psr-4": {
8+
"Robole\\SuluVideoBundle\\": "src/"
9+
}
10+
},
11+
"authors": [
12+
{
13+
"name": "FlxRobole",
14+
"email": "[email protected]"
15+
}
16+
],
17+
"homepage": "https://github.com/robole-dev/sulu-video-bundle",
18+
"require": {
19+
"php": "^8.2",
20+
"sulu/sulu": "^2.5",
21+
"symfony/config": "^6.0 | ^7.0",
22+
"symfony/dependency-injection": "^6.0 | ^7.0",
23+
"symfony/framework-bundle": "^6.0 | ^7.0",
24+
"jackalope/jackalope-doctrine-dbal": "*"
25+
},
26+
"config": {
27+
"allow-plugins": {
28+
"symfony/flex": true,
29+
"php-http/discovery": true
30+
},
31+
"sort-packages": true
32+
},
33+
"require-dev": {
34+
"friendsofphp/php-cs-fixer": "^3.66",
35+
"phpunit/phpunit": "^11.5"
36+
},
37+
"scripts": {
38+
"phpunit": "@php vendor/bin/phpunit",
39+
"php-cs": "@php vendor/bin/php-cs-fixer fix --verbose --diff --dry-run",
40+
"php-cs-fix": "@php vendor/bin/php-cs-fixer fix"
41+
}
42+
}

0 commit comments

Comments
 (0)