Charcoal service provider for an embed property.

0.1.6 2020-06-09 19:47 UTC

This package is auto-updated.

Last update: 2020-08-09 20:20:26 UTC


License Latest Stable Version Code Quality Coverage Status Build Status

A Charcoal service provider embed property.

Table of Contents


The preferred (and only supported) method is with Composer:

$ composer require locomotivemtl/charcoal-contrib-embed



Service Provider

The following services are provided with the use of charcoal-contrib-embed


  • embed/repository instance of Embed\EmbedRepository
    • Charcoal\Embed\Mixin\EmbedRepositoryTrait provided for ease of use.


Include the embed module in the projects's config file. This will provide everything needed for charcoal-contrib-embed to work properly. No need for metadata/views/action/routes path etc.

    "modules": {
       "charcoal/embed/embed": {}

You can provide additional configurations in the project's config file like so :

    "embed_config": {
        "ttl": 3600,
        "format": "array",
        "table": "embed_cache"

This is the actual default config.


The Embed Contrib provides a custom Property type : "embed". When using it, the property will fetch embed data from media providers and store them in a third table.

    "video": {
        "type": "embed",
        "l10n": true,
        "label": {
            "en": "Video",
            "fr": "Video"
        "notes": "Full video url. ex.: https://www.youtube.com/watch?v=_VIDEO_ID"

To load the embed data from database, use EmbedRepository service method


Dependency injection :

use EmbedRepositoryTrait;

 * Inject dependencies from a DI Container.
 * @param  Container $container A dependencies container instance.
 * @return void
protected function setDependencies(Container $container)


To install the development environment:

$ composer install

To run the scripts (phplint, phpcs, and phpunit):

$ composer test

API Documentation

Development Dependencies

  • [php-coveralls/php-coveralls][phpcov]
  • [phpunit/phpunit][phpunit]
  • [squizlabs/php_codesniffer][phpcs]

Coding Style

The charcoal-contrib-embed module follows the Charcoal coding-style:

Coding style validation / enforcement can be performed with composer phpcs. An auto-fixer is also available with composer phpcbf.



Charcoal is licensed under the MIT license. See LICENSE for details.