PHPackages                             venca-x/social-login - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. venca-x/social-login

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

venca-x/social-login
====================

Nette addon. Login with social networks ( Faceboook, Google, Twitter )

1.2.15(4y ago)8393.5k↓50%10MITPHPPHP &gt;=7.2

Since Dec 27Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/venca-x/social-login)[ Packagist](https://packagist.org/packages/venca-x/social-login)[ RSS](/packages/venca-x-social-login/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (8)Versions (28)Used By (0)

social-login
============

[](#social-login)

[![Build Status](https://camo.githubusercontent.com/84596906b44f9513bbde2054df66bdec4ab0c6bc78c2897a9b4f33ec99af5de1/68747470733a2f2f6170702e7472617669732d63692e636f6d2f76656e63612d782f736f6369616c2d6c6f67696e2e7376673f6272616e63683d6d6173746572)](https://app.travis-ci.com/github/venca-x/social-login)[![Coverage Status](https://camo.githubusercontent.com/1383088ab1f904b58858d353a67592e74286645af6ea09ececc0775030b03d8f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f76656e63612d782f736f6369616c2d6c6f67696e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/venca-x/social-login?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/1379ba6c6360ba2a3f34f25085a1001231356f453208741d42cf47faa613bfb5/68747470733a2f2f706f7365722e707567782e6f72672f76656e63612d782f736f6369616c2d6c6f67696e2f762f737461626c652e737667)](https://packagist.org/packages/venca-x/social-login)[![Latest Unstable Version](https://camo.githubusercontent.com/9998a2776491e9b61121b1844ded907a128d49e2123f3ca8d72224e7387ecbdf/68747470733a2f2f706f7365722e707567782e6f72672f76656e63612d782f736f6369616c2d6c6f67696e2f762f756e737461626c652e737667)](https://packagist.org/packages/venca-x/social-login)[![Total Downloads](https://camo.githubusercontent.com/3836ff0b8477d5a45ffdb39f3fcc9a1fe8c6d71bc0646a06ae06b25e3bf5d6a1/68747470733a2f2f706f7365722e707567782e6f72672f76656e63612d782f736f6369616c2d6c6f67696e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/venca-x/social-login)[![License](https://camo.githubusercontent.com/21c7748fb7fd501f87046d0999ebd3fe9ac827e890de576258bcd6befe73a6be/68747470733a2f2f706f7365722e707567782e6f72672f76656e63612d782f736f6369616c2d6c6f67696e2f6c6963656e73652e737667)](https://packagist.org/packages/venca-x/social-login)

Nette addon for login with social networks

VersionFacebook App APIPHPRecommended Nettedev-master8.0 or own&gt;= 7.2 (support 8.0)Nette 3.01.2.x8.0 or own&gt;= 7.2 (support 8.0)Nette 3.01.1.x2.6&gt;= 7.0Nette 2.4 (Nette\\SmartObject)1.0.x2.6&gt;= 5.5Nette 2.4, 2.3 (Nette\\Object)[All permissions for Facebook fields](https://developers.facebook.com/docs/graph-api/reference/user/)

Installation
------------

[](#installation)

Install **dev-master** version for **Nette 3.0**:

```
composer require venca-x/social-login:dev-master

```

Install **1.2.x** version for **Nette 3.0** (Nette\\SmartObject):

```
composer require venca-x/social-login:^1.2.0

```

Install **1.1.x** version for **Nette 2.4** (Nette\\SmartObject):

```
composer require venca-x/social-login:^1.1.0

```

Install **1.0.x** version for **Nette 2.4** or **Nette 2.3** (Nette\\Object):

```
composer require venca-x/social-login:^1.0.0

```

Configuration
-------------

[](#configuration)

config.neon

```
	parameters:
		facebook:
			appId: '123456789'
			appSecret: '987654321'
			callbackURL: 'http://www.muj-web.cz/homepage/facebook-login'
			defaultFbGraphVersion: 'v8.0'
		google:
			clientId: '123456789'
			clientSecret: '987654321'
			callbackURL: 'http://www.muj-web.cz/homepage/google-login'
		twitter:
			consumerKey: '123456789'
			consumerSecret: '987654321'
			callbackURL: 'http://www.muj-web.cz/homepage/twitter-login'

	nette:
		session:
			autoStart: true  # default is smart

    services:
        ...
        - VencaX\SocialLogin({ facebook: %facebook%, google: %google%, twitter: %twitter% }, 'domain-social-login' )

```

Where 'domain-social-login' replace to your unique identifier (it's cookie name for last used services for login)

BasePresenter.php

```
    use VencaX;

    /** @var VencaX\SocialLogin */
    private $socialLogin;

    public function injectSocialLogin( VencaX\SocialLogin $socialLogin )
    {
        $this->socialLogin = $socialLogin;

        //set scope
        $this->socialLogin->facebook->setScope( ['email'] );
        $this->socialLogin->google->setScope( array( "https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/userinfo.email" ) );
    }

    public function renderIn() {
        //$facebookLoginUrl = $this->socialLogin->facebook->getLoginUrl();
        //$googleLoginUrl = $this->socialLogin->google->getLoginUrl();
        //$twitterLoginUrl = $this->socialLogin->twitter->getLoginUrl();

        //dump( $this->socialLogin->getSocialLoginCookie() );

        //$this->template->facebookLastLogin = $this->socialLogin->facebook->isThisServiceLastLogin();
        //$this->template->googleLastLogin = $this->socialLogin->google->isThisServiceLastLogin();
        //$this->template->twitterLastLogin = $this->socialLogin->twitter->isThisServiceLastLogin();
        //...
    }
```

Layout for in.latte:

```

     Zaregistrovat
```

### Simple login

[](#simple-login)

HomepagePresenter.php

```
    public function actionFacebookLogin()
    {
        try
        {
            $me = $this->socialLogin->facebook->getMe( array( FacebookLogin::ID, FacebookLogin::EMAIL, FacebookLogin::NAME, FacebookLogin::FIRST_NAME, FacebookLogin::LAST_NAME ) );
            dump( $me );
            exit;
        }
        catch( Exception $e )
        {
            $this->flashMessage( $e->getMessage(), "alert-danger" );
            $this->redirect("Homepage:default");
        }
    }

    public function actionGoogleLogin( $code )
    {
        try
        {
            $me = $this->socialLogin->google->getMe( $code );
            dump( $me );
            exit;
        }
        catch( Exception $e )
        {
            $this->flashMessage( $e->getMessage(), "alert-danger" );
            $this->redirect("Homepage:default");
        }
    }
    //...
```

### Simple logint with Twitter

[](#simple-logint-with-twitter)

```
    public function actionTwitterLogin($oauth_token, $oauth_verifier)
    {
        try {
            $me = $this->socialLogin->twitter->getMe($oauth_token, $oauth_verifier);
            //$me = $this->socialLogin->twitter->getMe($oauth_token, $oauth_verifier, true);//when zou want user's email
            dump($me);
            exit;
        } catch (Exception $e) {
            $this->flashMessage($e->getMessage(), 'alert-danger');
            $this->redirect('Homepage:default');
        }
    }
```

### Login with backlink

[](#login-with-backlink)

Use it when you want to redirect to specific URL after success login

HomepagePresenter.php

```
    private $backlink = null;

    //render where are links to social networks
    public function renderIn() {
        if ($this->backlink) {
            $this->socialLogin->facebook->setState($this->backlink);
            $this->socialLogin->google->setState($this->backlink);
        }

        //$facebookLoginUrl = $this->socialLogin->facebook->getLoginUrl();
        //$googleLoginUrl = $this->socialLogin->google->getLoginUrl();
        //$twitterLoginUrl = $this->socialLogin->twitter->getLoginUrl();

        //dump( $this->socialLogin->getSocialLoginCookie() );

        //$this->template->facebookLastLogin = $this->socialLogin->facebook->isThisServiceLastLogin();
        //$this->template->googleLastLogin = $this->socialLogin->google->isThisServiceLastLogin();
        //$this->template->twitterLastLogin = $this->socialLogin->twitter->isThisServiceLastLogin();
    }

    public function actionFacebookLogin($state = NULL)
    {
        try
        {
            if ($state) $this->backlink = $state;
            $me = $this->socialLogin->facebook->getMe();
            //dump( $me );
            //exit();
            if($this->backlink != null) {
                $this->redirect($this->backlink);
            }
        }
        catch( Exception $e )
        {
            $this->flashMessage( $e->getMessage(), "alert-danger" );
            $this->redirect("Homepage:default");
        }
    }

    public function actionGoogleLogin( $code, $state = NULL )
    {
        try
        {
            if ($state) $this->backlink = $state;
            $me = $this->socialLogin->google->getMe( $code );
            //dump( $me );
            //exit();
            if($this->backlink != null) {
                $this->redirect($this->backlink);
            }
        }
        catch( Exception $e )
        {
            $this->flashMessage( $e->getMessage(), "alert-danger" );
            $this->redirect("Homepage:default");
        }
    }
    ...
```

Registration
------------

[](#registration)

Facebook
--------

[](#facebook)

[Facebook Developers](https://developers.facebook.com/) - create new website app. Full: Settings -&gt; Web page -&gt; Site URL :

Google
------

[](#google)

[API Console - Google Code](https://console.developers.google.com) - create new project add Google+ API: APIs &amp; auth -&gt; APIs -&gt; Google+ API set ON credentials: APIs &amp; auth -&gt; Credentials -&gt; Crate new Client ID -&gt; Web application

Twitter
-------

[](#twitter)

[Register a new app at dev.twitter.com/apps/](https://apps.twitter.com/app/new)

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance54

Moderate activity, may be stable

Popularity41

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 91.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~101 days

Recently: every ~31 days

Total

27

Last Release

1525d ago

PHP version history (5 changes)v1.0-betaPHP &gt;= 5.4

v1.0.5PHP &gt;= 5.6

1.1.0PHP &gt;=7.1

v1.1.x-devPHP &gt;=7.0

1.2.6PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/118375a8804ba0a6a9e67531be1064cf2cf1ddd4669de5ca7cdc6f1618add53e?d=identicon)[venca-x](/maintainers/venca-x)

---

Top Contributors

[![venca-x](https://avatars.githubusercontent.com/u/4173836?v=4)](https://github.com/venca-x "venca-x (54 commits)")[![dada-amater](https://avatars.githubusercontent.com/u/3747040?v=4)](https://github.com/dada-amater "dada-amater (2 commits)")[![pitrrs](https://avatars.githubusercontent.com/u/4920476?v=4)](https://github.com/pitrrs "pitrrs (2 commits)")[![kubiq](https://avatars.githubusercontent.com/u/302721?v=4)](https://github.com/kubiq "kubiq (1 commits)")

---

Tags

phpnetteSocial LoginFacebook loginGoogle loginTwitter login

### Embed Badge

![Health badge](/badges/venca-x-social-login/health.svg)

```
[![Health](https://phpackages.com/badges/venca-x-social-login/health.svg)](https://phpackages.com/packages/venca-x-social-login)
```

###  Alternatives

[mageplaza/magento-2-social-login

Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps

1841.2M5](/packages/mageplaza-magento-2-social-login)[dukt/social

Let your visitors log into Craft with web services like Facebook, Google, Twitter…

1141.0k5](/packages/dukt-social)[hardywen/social-login

Use QQ or Sina Weibo login

111.9k](/packages/hardywen-social-login)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
