Skip to content

freerkminnema/socialment

 
 

Repository files navigation

Socialment - Socialite OAuth Support for Filament

Socialment

Latest Version on Packagist Tests Action Status Code Style Action Status PHPStan Action Status Total Downloads

About

Bring up-to-date and simple Socialite support to your Filament admin panel with this plugin. Adds OAuth buttons to your login page.

Ideal for Laravel and Filament users seeking a straightforward OAuth integration.

Warning

Socialment is currently in beta. Please report any issues you encounter. Caution is advised if you choose to use this package in production. Azure AD support has been the only tested provider so far.

References

This package extends Laravel Socialite. Socialite currently supports authentication via Facebook, Twitter, LinkedIn, Google, GitHub, GitLab, and Bitbucket out of the box.

Refer to the Socialite documentation for more information on how to configure your application to use these providers.

Many other providers are available via the Socialite Providers website. Refer to the documentation for each provider for information on how to configure your application to use them.

Demo

For an example usage of this package, see ChrisReedIO/Socialment-Demo.

image


Installation

You can install the package via composer:

composer require chrisreedio/socialment

Warning

You must set "minimum-stability": "dev", in your composer.json while Socialment is still in Beta.

Usage

Initial Setup

After installation you should publish and run the migration(s) with:

Important

This package requires that the users password field be nullable. If you have not already done so, you should update your users table migration to make this change.

php artisan vendor:publish --tag="socialment-migrations"
php artisan migrate

Then publish the config file with:

php artisan vendor:publish --tag="socialment-config"

Provider Configuration

Whether you're using the default providers or adding your own, you'll need to configure them in the socialment.php config file.

Configure the socialment.php config file to specify providers in the following format:

return [
    'providers' => [
        'azure' => [
            'icon' => 'fab-microsoft', // Font Awesome Brand Icon
            'label' => 'Azure', // Display Name on the Login Page
        ]
    ],
	// ... Other Configuration Parameters
];

This package also uses the Blade Font Awesome package by Owen Voke.

Search for brand icons on the Font Awesome Website.

Panel Configuration

Include this plugin in your panel configuration:

$panel
	->plugins([
		// ... Other Plugins
		\ChrisReedIO\Socialment\SocialmentPlugin::make(),
	])

Visibility Override

By default, the plugin displays the configured providers at the bottom of the login form. You can additionally override the visibility of the plugin by passing a boolean or closure to the visible method:

$panel->plugins([
    \ChrisReedIO\Socialment\SocialmentPlugin::make()
        ->visible(fn () => false)
]);

Extras

You may publish and customize the views using

php artisan vendor:publish --tag="socialment-views"

Config

This is the contents of the published config file:

return [
	'view' => [
		// Set the text above the provider list
        'prompt' => 'Or Login Via',
		// Or change out the view completely with your own
		'providers-list' => 'socialment::providers-list',
	],
	'routes' => [
		'home' => 'filament.admin.pages.dashboard',
	],
	'models' => [
		// If you want to use a custom user model, you can specify it here.
		'user' => \App\Models\User::class,
	],
	'providers' => [
        'azure' => [
        	'icon' => 'fab-microsoft',
        	'label' => 'Azure Active Directory',
        ]
	],
];

Testing

Note

Tests have yet to be written for this package. They are on my TODO list. I'm also open to PRs.

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Socialite OAuth Support for Filament

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 90.8%
  • Blade 5.9%
  • JavaScript 2.9%
  • CSS 0.4%