PHP code example of nf / social

1. Go to this page and download the library: Download nf/social library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nf / social example snippets


  'providers'  => [
        // .... Others providers 
        \NightFury\Social\SocialServiceProvider::class,
    ],



return [
  // Other config 
  'services'   => [
        'facebook' => [
            'client_id'     => 'your_facebook_app_client_id',
            'client_secret' => 'your_facebook_app_secret_key',
            'redirect'      => 'https://{your_domain}/oauth?provider=facebook', // use callback url from step 3
        ],
        'twitter'  => [
            'client_id'     => 'your_twitter_app_client_id',
            'client_secret' => 'your_twitter_app_secret_key',
            'redirect'      => 'https://{your_domain}/oauth?provider=twitter', // use callback url from step 3
        ],
        'google'   => [
            'client_id'     => '',
            'client_secret' => '',
            'redirect'      => '',
        ],
    ],
]

$facebook_login_url = \NightFury\Social\Facades\Social::driver('facebook')->stateless()->redirect()->getTargetUrl();
$google_login_url = \NightFury\Social\Facades\Social::driver('google')->stateless()->redirect()->getTargetUrl();
$twitter_login_url = \NightFury\Social\Facades\Social::driver('twitter')->redirect()->getTargetUrl();