1. Go to this page and download the library: Download 3x1io/laravel-socialiter 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/ */
3x1io / laravel-socialiter example snippets
namespace App\Providers;
use GeneaLabs\LaravelSocialiter\Socialiter;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function register()
{
//
}
public function boot()
{
Socialiter::ignoreMigrations();
}
}
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use GeneaLabs\LaravelSocialiter\Socialiter;
use Illuminate\Http\RedirectResponse;
use Laravel\Socialite\Facades\Socialite;
class SignInWithAppleController extends Controller
{
public function redirectToProvider() : RedirectResponse
{
// use Socialite, as before
return Socialite::driver("sign-in-with-apple")
->scopes(["name", "email"])
->redirect();
}
public function handleProviderCallback()
{
// but handle the callback using Socialiter
$user = (new Socialiter)
->driver("sign-in-with-apple")
->login();
// or you can use the facade:
$user = Socialiter::driver("sign-in-with-apple")
->login();
// or you can use the app binding:
$user = app("socialiter")
->driver("sign-in-with-apple")
->login();
}
}
sh
php artisan migrate
sh
php artisan vendor:publish --provider="GeneaLabs\LaravelSocialiter\Providers\ServiceProvider" --tag=migrations
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.