PHP code example of alisafari-dev / laravel-keycloak-sso

1. Go to this page and download the library: Download alisafari-dev/laravel-keycloak-sso 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/ */

    

alisafari-dev / laravel-keycloak-sso example snippets


#[Fillable(['name', 'email', 'password', 'personal_id'])]
class User extends Authenticatable
{
    // ...
}

->withMiddleware(function (Middleware $middleware): void {
    $middleware->redirectGuestsTo(fn () => route('keycloak-sso.login'));
})

Route::redirect('login', '/sso/login')->name('login');
bash
composer vendor:publish --tag=keycloak-sso-config
php artisan vendor:publish --tag=keycloak-sso-migrations
php artisan migrate
blade
<form method="POST" action="{{ route('keycloak-sso.logout') }}">
    @csrf
    <button type="submit">خروج</button>
</form>
bash
php artisan vendor:publish --tag=keycloak-sso-views