PHPackages                             larapkg/laravel-social-user - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. larapkg/laravel-social-user

ActiveProject[API Development](/categories/api)

larapkg/laravel-social-user
===========================

Social controller setup for using with Laravel Socialite

091[3 PRs](https://github.com/LaraPKG/laravel-social-user/pulls)PHP

Since Mar 26Pushed 2y ago2 watchersCompare

[ Source](https://github.com/LaraPKG/laravel-social-user)[ Packagist](https://packagist.org/packages/larapkg/laravel-social-user)[ RSS](/packages/larapkg-laravel-social-user/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Laravel Social User
===================

[](#laravel-social-user)

Laravel Social User is a package that allows you to easily add social login to your Laravel API.

Combined with [Laravel Socialite](https://laravel.com/docs/10.x/socialite), [Laravel Socialite Providers](https://socialiteproviders.netlify.app/)and [Laravel Passport](https://laravel.com/docs/10.x/passport), you can easily add social login to your API for many social login providers.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require larapkg/laravel-social-user
```

To publish the configuration file which enables the setting of your applications user model, run:

```
php artisan vendor:publish --provider="Larapkg\LaravelSocialUser\Providers\LaravelSocialProviderServiceProvider" --tag="config"
```

If you want to alter the migrations, you can publish them with:

```
php artisan vendor:publish --provider="Larapkg\LaravelSocialUser\Providers\LaravelSocialProviderServiceProvider" --tag="migrations"
```

Usage
-----

[](#usage)

Run the migration to create the `user_social_providers` table.

Then attach the `HasSocialUsers` trait to your user model.

Publish the config and set up your required details, ensuring you set the user model.

Remove any fields you no longer need from the user table migration or create and run a migration to remove them, or make fields nullable.

Add a social login button to your frontend application and use the social provider's SDK to get the user's access token. Then send a POST request to your API with the access token and the provider name.

`/social-login/[provider-name]` passing the `access_token` in the request body.

Considerations
--------------

[](#considerations)

So every application needs a user strategy, and this package does not provide one.

Well it does, but it's not necessarily a good one or suitable for your use case.

So do you ONLY want social login, so your not responsible for user accounts?, or do you want to manage user accounts yourself? From a [GDPR](https://gdpr-info.eu/) point of view etc., unless you know what you are doing, you should probably use the social login only strategy, and avoid storing any user data yourself that is not necessary. And provide a way for users to delete their accounts and maybe consider storing last\_login details and deleting accounts after a period of inactivity (good practice to email users before).

As such, this package stores only the social provider's user id, name, email address and avatar, and when a user is deleted, if you have attached the `HasSocialUsers` trait to your user model, it will also delete the social user records for that user.

When using this package, when passing the social providers `access_token` to your API, it will always create a new user unless the social provider account has the same name and email as an existing user. i.e. on social login of a previously used social login account, the same user will be used, but social login from a different social login account will create a new user and those accounts will not be linked in any way.

When using the `HasSocialUsers` trait, the `socialUsers()` method will return a `HasMany` relationship, so you can access the social users for a user.

Other Considerations
--------------------

[](#other-considerations)

Socialite and Passport should be installed, your social providers setup and your user model setup to use passport.

Those things are out of scope for this readme, but you can find more information on those things in the links below.

- [Laravel Socialite](https://laravel.com/docs/10.x/socialite)
- [Laravel Socialite Providers](https://socialiteproviders.netlify.app/)
- [Laravel Passport](https://laravel.com/docs/10.x/passport)

This package does not contain any tests.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e2afdd94a6f21a4ec2c5df569b80c1d47d6f5d0428f866f55c4bc117856b58b?d=identicon)[Ron Appleton](/maintainers/Ron%20Appleton)

---

Top Contributors

[![ronappleton](https://avatars.githubusercontent.com/u/3792420?v=4)](https://github.com/ronappleton "ronappleton (3 commits)")

---

Tags

apilaravelmobile-apppassportsocial-loginsocialitesocialite-providerswebsite

### Embed Badge

![Health badge](/badges/larapkg-laravel-social-user/health.svg)

```
[![Health](https://phpackages.com/badges/larapkg-laravel-social-user/health.svg)](https://phpackages.com/packages/larapkg-laravel-social-user)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
