A Yii2 module for embedding social plugins and widgets.

Overview

Krajee Logo
yii2-social
Donate

Stable Version Unstable Version License Total Downloads Monthly Downloads Daily Downloads

Module that enables access to social plugins for Yii Framework 2.0. It includes support for embedding plugins from the following networks into your website:

  • Disqus
  • Facebook
    • Like Button
    • Share Button
    • Send Button
    • Save Button
    • Embedded Posts
    • Embedded Videos
    • Follow Button
    • Comment Button
    • Page Plugin
  • Google Plus
    • Signin Plugin
    • +1 Button
    • Share Button
    • Follow Button
    • Page Badge
    • Person/Profile Badge
    • Community Badge
    • Embedded Posts
  • Google Analytics
  • Twitter
    • Share Button
    • Follow Button
    • Hash Tag Button
    • Mention Button
    • Embedded Posts/Tweets
    • Embedded Timeline
  • VKontakte
    • Comments Button
    • Embedded Post
    • Community/Group
    • Like Button
    • Recommendations
    • Poll Module
    • Authorization
    • Share Content
    • Subscribe
  • GitHub
    • Watch Button
    • Star Button
    • Fork Button
    • Follow Button
  • GitHubX
    • Watch Button
    • Star Button
    • Fork Button
    • Issue Button
    • Download Button
    • Follow Button

Installation

The preferred way to install this extension is through composer.

NOTE: Check the composer.json for this extension's requirements and dependencies. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json.

Either run

$ php composer.phar require kartik-v/yii2-social "@dev"

or add

"kartik-v/yii2-social": "@dev"

to the require section of your composer.json file.

Usage

Module Configuration

You can view usage and demos on the module.

'modules' => [
    'social' => [
        // the module class
        'class' => 'kartik\social\Module',

        // the global settings for the disqus widget
        'disqus' => [
            'settings' => ['shortname' => 'DISQUS_SHORTNAME'] // default settings
        ],

        // the global settings for the facebook plugins widget
        'facebook' => [
            'app_id' => 'FACEBOOK_APP_ID',
            'app_secret' => 'FACEBOOK_APP_SECRET',
        ],

        // the global settings for the google plugins widget
        'google' => [
            'clientId' => 'GOOGLE_API_CLIENT_ID',
            'pageId' => 'GOOGLE_PLUS_PAGE_ID',
            'profileId' => 'GOOGLE_PLUS_PROFILE_ID',
        ],

        // the global settings for the google analytic plugin widget
        'googleAnalytics' => [
            'id' => 'TRACKING_ID',
            'domain' => 'TRACKING_DOMAIN',
        ],
        
        // the global settings for the twitter plugins widget
        'twitter' => [
            'screenName' => 'TWITTER_SCREEN_NAME'
        ],
    ],
    // your other modules
]

Disqus

VIEW DEMO

Facebook

VIEW DEMO

Google+

VIEW DEMO

Google Analytics

VIEW DEMO

Twitter

VIEW DEMO

GitHub

VIEW DEMO

GitHubX

VIEW DEMO

License

yii2-social is released under the BSD-3-Clause License. See the bundled LICENSE.md for details.

Comments
  • This extension should update the PHP Facebook SDK to v4

    This extension should update the PHP Facebook SDK to v4

    I notice that this extension use the PHP SKD v3, I think you should change to v4 to be more future proof.

    Yii2 is brand new and a extension like yii2-social will be a most for many users, it deserves the last versions of social SDKs.

    enhancement 
    opened by fabiomlferreira 7
  • PHP Recoverable Error – yii\base\ErrorException

    PHP Recoverable Error – yii\base\ErrorException

    Argument 1 passed to Facebook\FacebookRequest::__construct() must be an instance of Facebook\FacebookSession, null given, called in F:\data\xampp\htdocs\wash\vendor\kartik-v\yii2-social\Module.php on line 224 and defined

    question 
    opened by joyit00 6
  • It's not possible to get session using FB token

    It's not possible to get session using FB token

    I'm trying to get session by FB token, but getFbSession() returns null.

    $social = Yii::$app->getModule('social');
    $fbSession = $social->getFbSession(['source' => '<TOKEN>']);
    

    where TOKEN - is string FB token

    Looks like the statement in kartik\social\Module:179 is incorrect:

           if (
                empty($source) || !is_string($source) || 
                !($source instanceof FacebookRedirectLoginHelper) || 
                !($source instanceof FacebookCanvasLoginHelper) || 
                !($source instanceof FacebookJavaScriptLoginHelper)
            ) {
                return null;
            }
    

    And the second part of the question. When I commented out that statement, getFbSession() returned correct FB session. But when I tried to get user I got error:

    $user = $social->getFbGraphUser(['session' => $fbSession]);
    
    You must provide or set a default application secret.
    {
        "name": "Exception",
        "message": "You must provide or set a default application secret.",
        "code": 701,
        "type": "Facebook\\FacebookSDKException",
        "file": "<my_path>\\www\\vendor\\facebook\\php-sdk-v4\\src\\Facebook\\FacebookSession.php",
        "line": 340,
    
    enhancement 
    opened by alexweb-zz 4
  • Error on install on Yii2 with composer

    Error on install on Yii2 with composer

    Error is : "Failed to clone [email protected]:facebook/facebook-php-sdk.git, git was not found, check that it is installed and in your PATH env. 'git' is not recognized as an internal or external command, operable program or batch file."

    question 
    opened by zachko 4
  • Unable to locate message source for category 'kvsocial'.

    Unable to locate message source for category 'kvsocial'.

    Prerequisites

    • [x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
    • [x] The issue still exists against the latest master branch of yii2-social.
    • [x] This is not an usage question. I confirm having gone through and read the documentation and demos.
    • [x] This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
    • x ] I have attempted to find the simplest possible steps to reproduce the issue.
    • [ ] I have included a failing test as a pull request (Optional).

    Steps to reproduce the issue

    1. I just added the yii2-social plugin as in documentation.
    2. I replaced the facebook sdk with facebook opengraph repo (as mentioned in your demo page)
    3. When i render the widget, it shows me this error.

    Expected behavior and actual behavior

    When I follow those steps, I see...

    I was expecting to see a facebook button but it gives ne i18n error (translation issue)

    Environment

    Browsers

    • [x] Google Chrome
    • [x] Mozilla Firefox
    • [x] Internet Explorer
    • [x] Safari

    Operating System

    • [x] Windows
    • [ ] Mac OS X
    • [x] Linux
    • [ ] Mobile

    Libraries

    • jQuery version:
    • yii2-social version:

    Isolating the problem

    • [ ] This bug happens on the demos page
    • [ ] The bug happens consistently across all tested browsers
    • [ ] This bug happens when using yii2-social without other plugins.

    The code breaks at line 207

    $label = ArrayHelper::remove($options, 'label', Yii::t('kvsocial', 'Login with Facebook')); var/lib/openshift/5749a71c89f5cfb4f000008c/app-root/runtime/repo/vendor/kartik-v/yii2-social/Module.php at line 207 – yii\BaseYii::t('kvsocial', 'Login with Facebook')

    screenshot from 2016-08-25 01-57-34

    opened by noorahmed94 3
  • Implement vk plugin

    Implement vk plugin

    Is it possible to implement vk plugin? VK is a huge social network. VK is implemented as client in yii2-authclient extension (link). It has well written documentation

    enhancement 
    opened by vladim1 3
  • Deprecated jQuery method usage in VK plugin

    Deprecated jQuery method usage in VK plugin

    Prerequisites

    • [x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
    • [x] The issue still exists against the latest master branch of yii2-social.
    • [x] This is not an usage question. I confirm having gone through and read the documentation and demos.
    • [x] This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
    • [x] I have attempted to find the simplest possible steps to reproduce the issue.
    • [ ] I have included a failing test as a pull request (Optional).

    Steps to reproduce the issue

    1. Open some page with VK share plugin in country, where VK is blocked (Ukraine, for example), or force processing of else-branch of condition (add false && or something):
    if (window.VK && VK.Share) {
        ...
    } else {
        ...
    }
    

    Expected behavior and actual behavior

    When I follow those steps, I see TypeError: url.indexOf is not a function message in browser's JavaScript console.

    I was expecting browser work without exception :)

    Environment

    Browsers

    • [x] Google Chrome
    • [x] Mozilla Firefox
    • [x] Internet Explorer
    • [ ] Safari

    Operating System

    • [x] Windows
    • [ ] Mac OS X
    • [x] Linux
    • [x] Mobile

    Libraries

    • jQuery version: 3.2.1
    • yii2-social version: 1.3.5

    Isolating the problem

    • [ ] This bug happens on the demos page
    • [x] The bug happens consistently across all tested browsers
    • [ ] This bug happens when using yii2-social without other plugins.
    wontfix 
    opened by miketsoft 2
  • can i change the facebook icon for like and sharing

    can i change the facebook icon for like and sharing

    Prerequisites

    • [x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
    • [ ] The issue still exists against the latest master branch of yii2-social.
    • [ ] This is not an usage question. I confirm having gone through and read the documentation and demos.
    • [ ] This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
    • [ ] I have attempted to find the simplest possible steps to reproduce the issue.
    • [ ] I have included a failing test as a pull request (Optional).

    Steps to reproduce the issue

    Expected behavior and actual behavior

    When I follow those steps, I see...

    I was expecting...

    Environment

    Browsers

    • [ ] Google Chrome
    • [x] Mozilla Firefox
    • [ ] Internet Explorer
    • [ ] Safari

    Operating System

    • [ ] Windows
    • [ ] Mac OS X
    • [x] Linux
    • [ ] Mobile

    Libraries

    • jQuery version:
    • yii2-social version:

    Isolating the problem

    • [ ] This bug happens on the demos page
    • [ ] The bug happens consistently across all tested browsers
    • [ ] This bug happens when using yii2-social without other plugins.
    opened by mohdbashir 2
  • Calling unknown method: kartik\social\Module::getFbApi()

    Calling unknown method: kartik\social\Module::getFbApi()

    Hello. I'm trying to use this awesome module, but it is not going to work :(

    I installed as described here. I'm reinstalling it 5th or 6th times (using composer). But everytime the same error. Please, explain me what am I doing wrong? Here are my codes: config/web.php

    'modules' => [
            'user' => [
                'class' => 'amnah\yii2\user\Module',
                // set custom module properties here ...
            ],
            'social' => [
                // the module class
                'class' => 'kartik\social\Module',
    
                // the global settings for the Disqus widget
                'disqus' => [
                    'settings' => ['shortname' => 'DISQUS_SHORTNAME'] // default settings
                ],
    
                // the global settings for the Facebook plugins widget
                'facebook' => [
                    'appId' => '****',
                    'secret' => '****',
                ],
    
                // the global settings for the Google+ Plugins widget
                'google' => [
                    'clientId' => 'GOOGLE_API_CLIENT_ID',
                    'pageId' => 'GOOGLE_PLUS_PAGE_ID',
                    'profileId' => 'GOOGLE_PLUS_PROFILE_ID',
                ],
    
                // the global settings for the Google Analytics plugin widget
                'googleAnalytics' => [
                    'id' => 'TRACKING_ID',
                    'domain' => 'TRACKING_DOMAIN',
                ],
    
                // the global settings for the Twitter plugin widget
                'twitter' => [
                    'screenName' => 'TWITTER_SCREEN_NAME'
                ],
    
                // the global settings for the GitHub plugin widget
                'github' => [
                    'settings' => ['user' => 'GITHUB_USER', 'repo' => 'GITHUB_REPO']
                ],
            ],
    

    And controller:

    public function actionPublish() {
    
            $social = Yii::$app->getModule('social');
            $social->facebook = [
                'appId' => '***',
                'secret' => '***',
                // any other custom settings
            ];
            // fetch the facebook sdk api
            $facebook = $social->getFbApi();
    
        }
    

    The error:

    Unknown Method – yii\base\UnknownMethodException
    
    Calling unknown method: kartik\social\Module::getFbApi()
    
    $facebook = $social->getFbApi();
    

    But this is working: http://demos.krajee.com/social#facebook

    opened by anvarulugov 2
  • Fix the issue with Widget::getConfig()

    Fix the issue with Widget::getConfig()

    This change breaks the module. Throwing the exception Call to undefined method kartik\base\Config::getModule(). Should use \Yii::$app->getModule().

    invalid 
    opened by madand 2
  • facebook comments width

    facebook comments width

    How can I make the facebook comment box wider?

    This does not change the width:

    'settings' => [
                        'data-width' => '784px',
                        'width' => '784px',
                        'data-num_posts' => 20,
                    ],
    
    opened by golles 2
  • Social updates

    Social updates

    Hi,

    I think that you need:

    1 - Remove Google Plus (it not exists more); 2 - Add pinterest (easy as others): https://developers.pinterest.com/tools/widget-builder

    Thanks.


    Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

    enhancement 
    opened by paulocoutinhox 0
Releases(v1.3.5)
  • v1.3.5(Sep 21, 2018)

  • v1.3.4(Sep 19, 2018)

    Date: 19-Sep-2018

    • Move all source code to src directory.
    • Enhance Disqus Plugin Count validation.
    • (enh #76): Add Myanmar Translations.
    • (enh #75): Update Russian Translations.
    • (enh #74): Update disqus plugin initialization.
    • (enh #70): Update Czech Translations.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.3(Mar 15, 2017)

    Date: 15-Mar-2017

    • (enh #62): Update Facebook SDK to release v5.0.
    • (enh #63): Add Polish Translations.
    • (enh #64): Add Dutch Translations.
    • (enh #66): Add Lithuanian Translations.
    • (enh #67): Add new class kartik\social\FacebookPersistentHandler.
    • Update message config to include all default standard translation files.
    • (enh #68): New FacebookPlugin::SAVE button.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.2(Aug 16, 2016)

    Date: 16-Aug-2016

    • (enh #42): Add Italian Translations.
    • (enh #43): Fix VK styles.
    • (enh #46): Update to Facebook SDK release v5.0. (BC Breaking Change).
    • (enh #47): Update Facebook Plugin for latest FB graph version (BC Breaking Change).
    • Add branch alias for dev-master latest release.
    • (bug #51): Fix VkPlugin undefined variable error.
    • (enh #56): Auto set right Facebook language.
    • (enh #57): Initialize session via Yii standard methods.
    • (enh #58): Add Brazilian Portuguese Translations.
    • (enh #59): Add Portuguese Translations.
    • (bug #60): Correct noscript validation.
    • Add contribution templates.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.1(Jul 19, 2015)

    Date: 19-Jul-2015

    • (enh #21): Implement VKontakte plugin.
    • (enh #26): Add option to disable credits after Disqus widget.
    • Update copyright year till current.
    • (enh #29): Validate Disqus comment rendering for older IE browsers.
    • (enh #30): Generate default en message translation file.
    • (enh #32): Enhancements to generate Facebook session better.
    • (enh #33): Add Spanish translations.
    • (enh #35): Better composer version dependencies for Facebook SDK.
    • (enh #36): Add FacebookPlugin::async property.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Feb 13, 2015)

    Date: 13-Feb-2015

    • (enh #6): Remove Facebook PHP SDK support (old version v3.0).
    • (enh #10): German translations added
    • (enh #11): Hungarian translations added
    • (enh #12): Ukranian & Russian translations added
    • (enh #13): New features for PHP SDK v4.0
      • Implement an extended FacebookRedirectLoginHelperX class for handling sessions the Yii way
      • New getFbLoginHelper method in social module to fetch the Redirect Login Helper object instance based on the module level facebook settings
      • New initFbSession method in social module to initialize a facebook session
      • New getFbSession method in social module to get a facebook session either based on string token, redirect login url, canvas login, or Javascript login.
      • New getFbGraphUser method gets the Facebook graph user object for current user.
      • Changes from earlier release
        • Method getFbApihas been removed from the social module
        • Method getFbUser has been removed from the social module
        • Set release to stable.
    • (enh #14): Add new configuration for GoogleAnalytics anonymizeIp.
    • (enh #15): Various enhancements and additional configuration settings for the GoogleAnalytics widget:
      • Remove support for old version (widget only supports the new Google Universal Analytics plugin)
      • New testMode property that defaults to YII_DEBUG definition to allow google analytics to work from localhost.
      • Ability to configure tracking object name. Defaults to __gaTracker.
      • Ability to configure trackerConfig settings for creation of the ga object.
      • Ability to configure sendConfig settings for sending of the ga data.
      • Ability to configure anonymizeIp property.
      • Ability to add additional javascript before sending the ga data.
      • Ability to add additional javascript after sending the ga data.
    • (enh #18): Separate Github star and watch buttons as per v2.0.
    • (enh #19): Implement GithubXPlugin based on github buttons.
    • (enh #20): Allow social module to be used as an embedded submodule.
    • (enh #22): Set dependency on kartik-v/yii2-krajee-base.
    • (enh #23): Enhance Facebook plugin and fix comments plugin width property.
    • Set copyright year to current.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Nov 10, 2014)

  • v1.1.0(Nov 10, 2014)

  • v1.0.0(Oct 8, 2014)

Tarantool connector for yii2 framework. Allow to use activerecord, schemas, widgets and more.

Tarantool connector for yii2 framework Tarantool connector for yii2 framework. Allow to use framework abstractions such as ActiveRecord, Schema, Table

Andrey 11 Nov 21, 2021
An enhanced FileInput widget for Bootstrap 4.x/3.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)

yii2-widget-fileinput The FileInput widget is a customized file input widget based on Krajee's Bootstrap FileInput JQuery Plugin. The widget enhances

Kartik Visweswaran 227 Nov 6, 2022
An enhanced Yii 2 widget encapsulating the HTML 5 range input (sub repo split from yii2-widgets)

yii2-widget-rangeinput The RangeInput widget is a customized range slider control widget based on HTML5 range input. The widget enhances the default H

Kartik Visweswaran 19 Mar 12, 2022
Simple RBAC Manager for Yii2 (minify of yii2-admin)

Yii2 Mimin Simple RBAC Manager fo Yii 2.0. Minify of yii2-admin extension with awesome features Attention Before you install and use this extension, t

Hafid Mukhlasin 52 Sep 22, 2022
Yii2 SwitchInput widget turns checkboxes and radio buttons into toggle switchinputes

Yii2 SwitchInput widget turns checkboxes and radio buttons into toggle switchinputes

Kartik Visweswaran 38 Sep 21, 2022
Web Push Notifications brought to Yii2

Web Push Notifications for Yii 2 An extension for implementing Web Push Notifications on your website in a breeze. Documentation is at docs/README.md

Mehdi Achour 12 May 19, 2022
yii2-app-advanced with Twitter Bootstrap 5

Yii 2 Advanced Project Template is a skeleton Yii 2 application best for developing complex Web applications with multiple tiers.

Nedarta 1 Nov 5, 2021
Prometheus exporter for Yii2

yii2-prometheus Prometheus Extension for Yii 2 This extension provides a Prometheus exporter component for Yii framework 2.0 applications. This extens

Mehdi Achour 3 Oct 27, 2021
Yii2-symfonymailer - Yii 2 Symfony mailer extension.

Yii Mailer Library - Symfony Mailer Extension This extension provides a Symfony Mailer mail solution for Yii framework 2.0. For license information ch

Yii Software 28 Dec 22, 2022
Yii2 console application used to write our processors of methods to responsible to client calling.

Microservice Application Skeleton Yii2 console application used to write our processors of methods to responsible to client calling. This application

Jafaripur 0 Mar 10, 2022
Date/Time Picker widget for Yii2 framework Based on Eonasdan's Bootstrap 3 Date/Time Picker

Yii2 Date/Time Picker Widget Date/Time Picker widget for Yii2 framework Based on Eonasdan's Bootstrap 3 Date/Time Picker Demo Since this is a part of

Yevhen Terentiev 8 Mar 14, 2022
Yii2 extension for format inputs based on AutoNumeric.js

Yii2 extension for format inputs based on AutoNumeric.js

extead 2 Oct 7, 2019
Pug Yii2 adapter

Yii 2 Pug (ex Jade) extension This extension provides a view renderer for Pug templates for Yii framework 2.0 applications. Support GutHub issues Inst

Pug PHP 8 Jun 17, 2022
This is Yii2 utilities

YII2-UTILITY This is Yii2 utilities. Requirements PHP >= 7.4 Curl extension for PHP7 must be enabled. Download Using Composer From your project direct

null 0 Jun 30, 2022
Alejandro Flores, Php Yii2 Emoac

Prueba Tecnica Emoac Proyecto basado en PHP con Yii2. Hecho por Alejandro Flores, Ingeniero en informática. Este proyecto consta de un CRUD de product

FlamesAlejandro 2 Sep 13, 2022
Eine Feature Reiche Core aus Verschiedenen Plugins und Eigenkreation.

CoreV5 ALPHA Du willst helfen? Hier mein Discord! Download und Wichtig Hier downloaden! Das Core Plugin wurde speziell für CityBuild Server entwickelt

TheNote 15 Sep 24, 2022
Generalized user interface framework for PocketMine plugins.

ActionApi Generalized user interface framework for PocketMine plugins. How does this work? ActionApi introduces the following concepts: Action Action

Jonathan Chan Kwan Yin 15 Aug 17, 2022
With this extension you can share data from your web pages to any social network!

Extension for sharing on social networks With this extension you can share data from your web pages to any social network! Features: SEO support, defa

Yii Maker 50 Oct 15, 2022
Geography module for Yii 2

Geography module for Yii 2

Sergey Fedorov 13 Oct 20, 2018