PHP code example of milon / bohurupee-laravel

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

    

milon / bohurupee-laravel example snippets


use Milon\Bohurupee\OAuthErrorException;

try {
    $user = Socialite::driver($provider)->user();
} catch (OAuthErrorException $e) {
    return response()->json($e->toArray(), 400);
}

use Laravel\Socialite\Facades\Socialite;

Route::get('/login/{provider}', function (string $provider) {
    return Socialite::driver($provider)->redirect();
});

Route::get('/auth/{provider}/callback', function (string $provider) {
    $user = Socialite::driver($provider)->user();

    return [
        'id' => $user->getId(),
        'email' => $user->getEmail(),
        'name' => $user->getName(),
        'nickname' => $user->getNickname(),
        'avatar' => $user->getAvatar(),
    ];
});
bash
php artisan vendor:publish --tag=bohurupee-config