Installation
Add the repository to composer.json under "repositories":
"repositories": {
"bibsdb/info-portrait-bundle": {
"type": "vcs",
"url": "https://github.com/bibsdb/info-portrait-bundle"
}
}
Require the bundle:
composer require bibsdb/info-portrait-bundle
Enable the Bundle
Register the bundle in config/bundles.php (Symfony 4.3+):
return [
// ...
Bibsdb\InfoPortraitBundle\BibsdbInfoPortraitBundle::class => ['all' => true],
];
Load the Template Run the command to load the slide template:
php bin/console bibsdb:core:templates:load
Enable in Admin Navigate to the Symfony admin panel (e.g., EasyAdmin) and enable the InfoPortrait template.
Embed an InfoPortrait video in a slide:
Slide Creation Use the bundle’s template in your slide management system (e.g., EasyAdmin, SonataAdmin). Example (Symfony Form):
$builder->add('infoPortraitVideoId', TextType::class, [
'label' => 'InfoPortrait Video ID',
'required' => true,
]);
Dynamic Video Embedding Render the video in Twig:
{{ render(controller('BibsdbInfoPortraitBundle:Default:renderVideo', {
'videoId': slide.infoPortraitVideoId
})) }}
Custom Player Configuration Override the default player settings via Twig:
{% set playerOptions = {
'autoplay': false,
'controls': false,
'ads': false -- Requires PLUS account
} %}
{{ render(controller('BibsdbInfoPortraitBundle:Default:renderVideo', {
'videoId': slide.infoPortraitVideoId,
'options': playerOptions
})) }}
Ads and Controls
info-portrait.com dashboard for user permissions.Template Loading
bibsdb:core:templates:load fails, verify:
config/bundles.php.Bibsdb\CoreBundle (dependency) is installed.php bin/console cache:clear
CORS Issues
info-portrait.com:
// config/packages/security.yaml
cors:
paths:
'^/api/':
allow_origin: ['*']
Check Console Logs
Run the command with -v for verbose output:
php bin/console bibsdb:core:templates:load -v
Inspect Network Requests Use browser dev tools to verify the player script loads:
// Expected: https://cdn.info-portrait.com/player.js
Fallback for Missing Videos Handle missing video IDs gracefully in Twig:
{% if slide.infoPortraitVideoId %}
{{ render(controller(...)) }}
{% else %}
<p>Video not configured.</p>
{% endif %}
Custom Player Styling Override the bundle’s assets:
# Copy default assets
cp -r vendor/bibsdb/info-portrait-bundle/Resources/public/* public/bundles/infoportrait/
Extend CSS/JS in assets/infoportrait/.
Add Analytics
Hook into the player’s onReady event (via JavaScript):
document.addEventListener('DOMContentLoaded', function() {
window.InfoPortraitPlayer.onReady(function(player) {
// Track video events (e.g., play, pause)
player.on('play', function() { console.log('Played!'); });
});
});
Localization Translate template labels via Symfony’s translation system:
# config/packages/translation.yaml
locales: ['en', 'fr']
default_locale: 'en'
Add translations in translations/messages.en.yaml:
bibsdb.infoportrait.video_id: "Video ID"
How can I help you explore Laravel packages today?