PHP code example of monster010 / socialitediscord

1. Go to this page and download the library: Download monster010/socialitediscord 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/ */

    

monster010 / socialitediscord example snippets


'discord' => [    
  'client_id' => env('DISCORD_CLIENT_ID'),  
  'client_secret' => env('DISCORD_CLIENT_SECRET'),  
  'redirect' => env('DISCORD_REDIRECT_URI'),
  
  // optional
  'allow_gif_avatars' => (bool)env('DISCORD_AVATAR_GIF', true),
  'avatar_default_extension' => env('DISCORD_EXTENSION_DEFAULT', 'png'), // only pick from jpg, png, webp
],

Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
    $event->extendSocialite('discord', \SocialiteProviders\Discord\Provider::class);
});

protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // ... other providers
        \SocialiteProviders\Discord\DiscordExtendSocialite::class.'@handle',
    ],
];

return Socialite::driver('discord')->redirect();