Skip to content

yii2song/yii2-link-preview

 
 

Repository files navigation

Yii2 Link Preview Widget

LinkPreview widget automatically retrieves some information from the content of the link.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yii2mod/yii2-link-preview "*"

or add

"yii2mod/yii2-link-preview": "*"

to the require section of your composer.json file.

Usage

  1. Execute init migration:
php yii migrate/up --migrationPath=@vendor/yii2mod/yii2-link-preview/migrations
  1. Define preview action in your controller:
public function actions()
{
    return [
        'link-preview' => LinkPreviewAction::className()
    ];
}
  1. Add widget to your page as follows:
echo LinkPreview::widget([
    'selector' => '#your-input-id or .someclass',
    'clientOptions' => [
        'previewActionUrl' => \yii\helpers\Url::to(['link-preview'])
    ],
])

Example preview


Alt text

About

LinkPreview widget render page preview

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 85.8%
  • JavaScript 11.3%
  • CSS 2.9%