Skip to content

RonasIT/laravel-clerk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Clerk Guard

Introduction

This package offers an authentication guard to seamlessly integrate Clerk authentication into your Laravel project.

Installation

  1. Use Composer to install the package:
composer require ronasit/laravel-clerk
  1. Publish the package configuration:
php artisan vendor:publish --provider=RonasIT\\Clerk\\Providers\\ClerkServiceProvider
  1. Add a new clerk guard within the guards array in your config/auth.php file:
return [
    'defaults' => [
        'guard' => 'clerk',
        'passwords' => 'users',
    ],

    'guards' => [
        'clerk' => [
            'driver' => 'clerk_session',
            'provider' => 'users',
        ],
        // Other guards...
    ],
  1. Populate the necessary configuration options in config/clerk.php.

Usage

By default, your app returns the User class with just the external_id property, which holds the user's ID in Clerk.

To customize this behavior, you'll need to create your own UserRepository that implements the UserRepositoryContract. Then, rebind it in one of the service providers:

use RonasIT\Clerk\Contracts\ClerkUserRepositoryContract;
use App\Support\Clerk\MyAwesomeUserRepository;

class AppServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->app->bind(ClerkUserRepositoryContract::class, MyAwesomeUserRepository::class);
    }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages