PHPackages                             oneofftech/laravel-connect-identity - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. oneofftech/laravel-connect-identity

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

oneofftech/laravel-connect-identity
===================================

Add user registration and log in via third party OAuth services

v0.5.0(10mo ago)11.4k[1 issues](https://github.com/OneOffTech/laravel-connect-identity/issues)MITPHPPHP ^8.2CI passing

Since Sep 4Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/OneOffTech/laravel-connect-identity)[ Packagist](https://packagist.org/packages/oneofftech/laravel-connect-identity)[ RSS](/packages/oneofftech-laravel-connect-identity/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (15)Versions (11)Used By (0)

Connect Identity for Laravel
============================

[](#connect-identity-for-laravel)

[![CI](https://github.com/OneOffTech/laravel-connect-identity/workflows/CI/badge.svg)](https://github.com/OneOffTech/laravel-connect-identity/workflows/CI/badge.svg)

Add registration and log in to you application via third party identity providers (e.g. Gitlab, Facebook, ...).

While the package provides controllers, models, migrations and routes to handle registration and login actions it does not dictate how the user interface should look and how to validate users' data. It does however provide a starting point that you can customize based on your needs.

The package is compatible with [Laravel Socialite](https://laravel.com/docs/socialite) providers as well as the community driven [Socialite Providers](https://socialiteproviders.com/).

**features**

- Handle user registration via third party providers;
- Handle user log in via third party providers;
- Allow existing user to link a third party identity;
- Customizable controllers, migration and models that will live in your application namespace;
- Save identity and token inside the database, using [encryption and pseudoanonimization](#how-data-is-stored-in-the-database);
- Provide login/register/connect button as Blade component;
- Support all [Laravel Socialite](https://laravel.com/docs/socialite)and [Socialite Providers](https://socialiteproviders.com/);
- Add custom providers.

**requirements**

- PHP 8.2 or above

Getting started
---------------

[](#getting-started)

### Installation

[](#installation)

You can install this package via Composer by running this command in your terminal in the root of your project:

```
composer require oneofftech/laravel-connect-identity
```

> The service provider `Oneofftech\Identities\IdentitiesServiceProvider::class`is automatically registered as part of the Laravel service discovery.

### Generate migrations, controllers and models

[](#generate-migrations-controllers-and-models)

The package provides the login and registration features via traits. Once the `oneofftech/laravel-connect-identity` package has been installed, you can generate the controllers, models and migrations scaffolding using the `ui:identities` Artisan command:

```
php artisan ui:identities

```

Now you can add the `WithIdentities` trait to your `User` model. This is required to use the `identities` relationship required during the registration/login process.

```
// ...

use Oneofftech\Identities\WithIdentities;

class User extends Authenticatable
{
    use WithIdentities;

    // ...
}
```

> If your application has a different namespace than `App` please refer to [Using a personalized application namespace](#using-a-personalized-application-namespace)for additional required setup actions.

### Configure the Socialite providers

[](#configure-the-socialite-providers)

Before using an identity provider, e.g. `facebook`, `google`, `github`, `gitlab`, configure the required options inside the `services` configuration file.

> To see the driver specific configuration please refer to [Laravel's documentation](https://laravel.com/docs/socialite) or the [Socialite Providers documentation](https://socialiteproviders.com/).

> The `redirect` url configuration is not required as the redirect url is set automatically.

```
    'gitlab' => [
        'client_id' => env('GITLAB_CLIENT_ID'),
        'client_secret' => env('GITLAB_CLIENT_SECRET'),
        'redirect' => null, // set in the controller no need to specify
        'instance_uri' => env('GITLAB_INSTANCE_URI', 'https://gitlab.com/')
        // 'host' => env('GITLAB_INSTANCE_URI', 'https://gitlab.com/') // if using the default Socialite Gitlab driver
    ],
```

Tip

We do require also Socialite Providers Gitlab driver. So you need to include the `Identity::events()` in your app provider. If you want to use the Gitlab driver included in Laravel Socialite you can omitt `Identity::events()`. Remember to use `host` instead of `instance_uri` to configure the url of your Gitlab instance.

If you are using one of the community maintained [Socialite Providers](https://socialiteproviders.com/)remember to register their events in your `AppServiceProvider`.

If you are not using those providers this step is optional.

`oneofftech/laravel-connect-identity` provides out-of-the-box support for the `gitlab`and `dropbox` driver. If you are using those two you might add the following call to your `AppServiceProvider`.

```
public function boot()
{
    parent::boot();

    \Oneofftech\Identities\Facades\Identity::events();
}
```

This will register the `SocialiteWasCalled` event for the Gitlab and Dropbox providers that are included by default.

### Include the login and register buttons

[](#include-the-login-and-register-buttons)

`oneofftech/laravel-connect-identity` does not dictate your User Interface preferences, however we provide a Blade Component to quickly add login and register links/buttons.

```

```

The available `action`s are `login`, `connect` and `register`. The `provider` refers to what identity provider to use, the name of the provider is the same as the Socialite providers' name. See [Blade components](https://laravel.com/docs/blade#components) for more.

In case of errors, mainly connected to validation, you can catch those by looking at the used provider key in the Laravel default ErrorBag.

```
@error('gitlab')

        {{ $message }}

@enderror
```

Digging Deeper
--------------

[](#digging-deeper)

### Using a personalized application namespace

[](#using-a-personalized-application-namespace)

While the `ui:identities` command is namespace aware some of the runtime configuration is not.

If you are using a custom application namespace instead of the default `App`, you need to tell which namespace and models to use.

To do so add the following lines in your `AppServiceProvider`;

```
use Oneofftech\Identities\Facades\Identity;

class AppServiceProvider extends ServiceProvider
{

    public function boot()
    {
        Identity::useNamespace("My\\Namespace\\");
        Identity::useIdentityModel("My\\Namespace\\Identity");
        Identity::useUserModel("My\\Namespace\\User");

        // ...
    }
}
```

### Passing additional data to the registration

[](#passing-additional-data-to-the-registration)

Sometimes you will need additional parameters do create a user after the authorization process on the third party service. To do so you can add as many parameters in the request made to the register route that redirects to the third party service.

By default additional request parameters are guarded and so you have to explicitly tell their name. You can do this by defining an `attributes` property or an `attributes` method on the `RegisterController` that returns an array of strings that represent the name of the allowed parameters.

```
protected $attributes = ['name'];

protected function attributes()
{
    return  ['name'];
}
```

The additional attributes will then passed to the `validator(array $data)` and `create(array $data)` function defined within the `RegisterController`.

If you are using the provided `IdentityLink` Blade component the data should be specified as associative array inside the `parameters` property.

```

```

Where `$arrayOfAdditionalParameters` is an associative array, e.g. `['invite' => 'token_value']`.

### How data is stored in the database

[](#how-data-is-stored-in-the-database)

Whenever possible data is stored encrypted or in a pseudo-anonymized form.

Encryption works by using the [Laravel's Encryption](https://laravel.com/docs/encryption) and the configured application key (i.e. `APP_KEY`). If you want to use a different key use the `IDENTITY_KEY` environment variable, the used cipher will be the same as configured in `app.cipher`.

The pseudo-anonymized values are stored as hashes of the original data.

Here is how sensible data is stored:

datatechniqueidentifier within third party servicepseudo-anonymizedauthentication tokenencryptedrefresh tokenencrypted> If you need to [rotate the APP\_KEY](https://divinglaravel.com/app_key-is-a-secret-heres-what-its-used-for-how-you-can-rotate-it)specify your old key inside `OLD_IDENTITY_KEY` to be able to still read encrypted values.

> **Warning** as of now no automated job is available for re-encrypting data with the new key. This operation happens during registration or while connecting an identity as part of the token update.

Contributing
------------

[](#contributing)

Thank you for considering contributing to the Connect Identity for Laravel! You can find how to get started in our [contribution guide](./CONTRIBUTING.md).

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review our [security policy](./SECURITY.md) on how to report security vulnerabilities.

License
-------

[](#license)

Laravel Connect Identity is licensed under the [MIT license](./LICENSE).

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~199 days

Recently: every ~315 days

Total

10

Last Release

327d ago

PHP version history (5 changes)v0.1.0PHP &gt;=7.2.5

v0.3.0PHP ^7.3

v0.3.1PHP ^7.3|^8.0

v0.3.3PHP ^7.3|^8.0.2

v0.3.4PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25452415?v=4)[OneOffTech](/maintainers/OneOffAdmins)[@OneOffAdmins](https://github.com/OneOffAdmins)

---

Top Contributors

[![avvertix](https://avatars.githubusercontent.com/u/5672748?v=4)](https://github.com/avvertix "avvertix (52 commits)")

---

Tags

connect-identityhacktoberfestidentity-providerlaravellaravel-socialitelogin-with-gitlabregistrationlaraveloauthloginregistrationlaravel socialite

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/oneofftech-laravel-connect-identity/health.svg)

```
[![Health](https://phpackages.com/badges/oneofftech-laravel-connect-identity/health.svg)](https://phpackages.com/packages/oneofftech-laravel-connect-identity)
```

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k89.4M575](/packages/laravel-passport)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9742.3M121](/packages/roots-acorn)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M122](/packages/laravel-pulse)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

721160.4k12](/packages/tallstackui-tallstackui)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8385.5M96](/packages/laravel-doctrine-orm)

PHPackages © 2026

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