dmstr/yii2-social-media-widgets

Yii2 Social Media Widgets

Maintainers

👁 schmunk

Package info

github.com/dmstr/yii2-social-media-widgets

Type:yii2-extension

pkg:composer/dmstr/yii2-social-media-widgets

Statistics

Installs: 5 764

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

0.0.3 2020-12-08 13:14 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

BSD-3-Clause 772768f6dd437ce91dcf6ffa656e6d061604e7f7

  • Elias Luhr <e.luhr.woop@herzogkommunikation.de>

extensionyii2

This package is auto-updated.

Last update: 2026-06-09 01:41:54 UTC


README

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist dmstr/yii2-social-media-widgets

or add

"dmstr/yii2-social-media-widgets": "*"

to the require section of your composer.json file.

Usage

PHP

use dmstr\socialmediawidgets\widgets\SocialMediaMeta;

SocialMediaMeta::widget([
 'title' => 'Title',
 'description' => 'Lorem ipsum dolor sit amet',
 'image' => 'https://example.com/example.png',
 'url' => 'https://example.com/mypage',
 'siteName' => 'Site Name',
 'twitterImageAlt' => 'Alt Text'
]);

TWIG

{{ use ('dmstr/socialmediawidgets/widgets/SocialMediaMeta') }}

{{ SocialMediaMeta_widget({
 title: title,
 description: description,
 image: image(image),
 url: url,
 siteName: siteName,
 twitterImageAlt: twitterImageAlt
}) }}

In combination with the dmstr yii2 widgets2 module you are may be interested in a json editor schema:

{
 "title": "SEO Social Media",
 "type": "object",
 "properties": {
 "title": {
 "title": "Title",
 "type": "string",
 "minLength": 1
 },
 "description": {
 "title": "Description",
 "type": "string",
 "minLength": 1
 },
 "image": {
 "title": "Image",
 "type": "string",
 "format": "filefly",
 "minLength": 1
 },
 "url": {
 "title": "URL",
 "type": "string"
 },
 "siteName": {
 "title": "Site Name",
 "type": "string"
 },
 "twitterImageAlt": {
 "title": "Twitter Image Alt",
 "type": "string"
 }
 }
}