All Projects β†’ yii2mod β†’ yii2-link-preview

yii2mod / yii2-link-preview

Licence: MIT license
LinkPreview widget render page preview

Programming Languages

PHP
23972 projects - #3 most used programming language
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to yii2-link-preview

yii2-vote
Provides voting for any model πŸ‘ πŸ‘Ž
Stars: ✭ 70 (+169.23%)
Mutual labels:  yii2, yii2-extension
yii2-user
Flexible user registration and authentication module for Yii2.
Stars: ✭ 24 (-7.69%)
Mutual labels:  yii2, yii2-extension
yii2-array-query
Yii2 component that allows for searching/filtering the elements of an array.
Stars: ✭ 34 (+30.77%)
Mutual labels:  yii2, yii2-extension
yii2-bankcard-info
ι“Άθ‘Œε‘ε‘ε·εˆ†ζžοΌˆYii2扩展)
Stars: ✭ 15 (-42.31%)
Mutual labels:  yii2, yii2-extension
yii2-formbuilder
A drag and drop form builder with jQuery for Yii2
Stars: ✭ 33 (+26.92%)
Mutual labels:  yii2, yii2-extension
yii2-linkable-behavior
Yii2 behavior to help creating urls easier
Stars: ✭ 12 (-53.85%)
Mutual labels:  yii2, yii2-extension
background-translation-i18n
Based on the YII2 module to translate JSON formatted translation files on the web
Stars: ✭ 11 (-57.69%)
Mutual labels:  yii2, yii2-extension
yii2-cashier
Yii2 Cashier provides an interface to Stripe's subscription billing services.
Stars: ✭ 43 (+65.38%)
Mutual labels:  yii2, yii2-extension
yii2-emoji
πŸ˜„ this is a emoji extension of yii2.
Stars: ✭ 17 (-34.62%)
Mutual labels:  yii2, yii2-extension
yii2-ion-slider
Easily customizable range slider with skins support.
Stars: ✭ 21 (-19.23%)
Mutual labels:  yii2, yii2-extension
yii2-jwt-tools
An easy way to configure JWT authentication and validation on Yii Framework 2 Projects
Stars: ✭ 22 (-15.38%)
Mutual labels:  yii2, yii2-extension
yii2-js-urlmanager
That extension provide a way to create urls from your frontend part.
Stars: ✭ 53 (+103.85%)
Mutual labels:  yii2, yii2-extension
yii2-pgsql
Improved PostgreSQL schemas for Yii2
Stars: ✭ 34 (+30.77%)
Mutual labels:  yii2, yii2-extension
yii2-rollbar
Rollbar for Yii2
Stars: ✭ 36 (+38.46%)
Mutual labels:  yii2, yii2-extension
behavior-trait
Allows handling events via inline declared methods, which can be added by traits
Stars: ✭ 18 (-30.77%)
Mutual labels:  yii2, yii2-extension
yii2-sweet-submit
sweet sumit using sweetalert
Stars: ✭ 26 (+0%)
Mutual labels:  yii2, yii2-extension
yii2-newsletter
Module for saving user contacts from newsletter form to database
Stars: ✭ 17 (-34.62%)
Mutual labels:  yii2, yii2-extension
ar-search
Provides unified search model for Yii ActiveRecord
Stars: ✭ 31 (+19.23%)
Mutual labels:  yii2, yii2-extension
yii2-elasticsearch
Elasticsearch client based on official Elasticsearch PHP library
Stars: ✭ 14 (-46.15%)
Mutual labels:  yii2, yii2-extension
yii2-lock-form
disable the button when form submit
Stars: ✭ 37 (+42.31%)
Mutual labels:  yii2, yii2-extension

Yii2 Link Preview Widget

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

Latest Stable Version Total Downloads License Build Status

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 of usage with the ActiveForm and saving the page info

  1. Create the basic form in the view:
<?php $form = \yii\widgets\ActiveForm::begin() ?>
    <div class="form-group">
        <label for="preview">Preview</label>
        <input name="preview" class="form-control" id="preview" placeholder="Preview">
    </div>
    <?php echo \yii2mod\linkpreview\LinkPreview::widget([
        'selector' => '#preview',
        'clientOptions' => [
            'previewActionUrl' => \yii\helpers\Url::to(['link-preview'])
        ],
    ]) ?>
    <div class="form-group">
        <?= \yii\helpers\Html::submitButton('Save', ['class' => 'btn btn-primary']) ?>
    </div>
<?php \yii\widgets\ActiveForm::end() ?>
  1. Add the following code to your action for the saving page info:
$model = new LinkPreviewModel();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
    $model->save();
}

// or the short version 

$linkPreviewId = LinkPreviewModel::saveAndGetId(Yii::$app->request->post());

GitHub Preview Example


Alt text

Video Link Preview Example


Alt text

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].