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

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

internetguru/laravel-user
=========================

Interent Guru Laravel User

v7.4.0(4w ago)03.3k↓79.5%MITPHPPHP ^8.4CI passing

Since Oct 7Pushed 4w ago2 watchersCompare

[ Source](https://github.com/internetguru/laravel-user)[ Packagist](https://packagist.org/packages/internetguru/laravel-user)[ RSS](/packages/internetguru-laravel-user/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (91)Versions (174)Used By (0)

Internet Guru Laravel User
==========================

[](#internet-guru-laravel-user)

Internet Guru Laravel User is a library that provides seamless integration with various social authentication providers. It stores the user's social identity in the database and allows the user to link multiple social identities to a single account. It also provides PIN-based login via email and a full user management UI.

BranchStatusCode CoverageMain[![tests](https://github.com/internetguru/laravel-user/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/internetguru/laravel-user/actions/workflows/test.yml/badge.svg?branch=main)[![coverage](https://raw.githubusercontent.com/internetguru/laravel-user/refs/heads/badges/main-coverage.svg)](https://raw.githubusercontent.com/internetguru/laravel-user/refs/heads/badges/main-coverage.svg)Staging[![tests](https://github.com/internetguru/laravel-user/actions/workflows/test.yml/badge.svg?branch=staging)](https://github.com/internetguru/laravel-user/actions/workflows/test.yml/badge.svg?branch=staging)[![coverage](https://raw.githubusercontent.com/internetguru/laravel-user/refs/heads/badges/staging-coverage.svg)](https://raw.githubusercontent.com/internetguru/laravel-user/refs/heads/badges/staging-coverage.svg)Dev[![tests](https://github.com/internetguru/laravel-user/actions/workflows/test.yml/badge.svg?branch=dev)](https://github.com/internetguru/laravel-user/actions/workflows/test.yml/badge.svg?branch=dev)[![coverage](https://raw.githubusercontent.com/internetguru/laravel-user/refs/heads/badges/dev-coverage.svg)](https://raw.githubusercontent.com/internetguru/laravel-user/refs/heads/badges/dev-coverage.svg)Table of Contents
-----------------

[](#table-of-contents)

- [Features and Terminology](#features-and-terminology)
- [Installation](#installation)
- [Configuration](#configuration)
- [Roles](#roles)
- [Socialite Providers](#socialite-providers)
- [Demo Mode](#demo-mode)
- [PIN Login](#pin-login)
- [Language and Locale](#language-and-locale)
- [User Management](#user-management)
- [Blade Components](#blade-components)
- [User Preferences](#user-preferences)
- [Association History](#association-history)
- [User Policy](#user-policy)
- [IgUserSeeder](#iguserseeder)
- [Publishing](#publishing)
- [E2E Tests](#e2e-tests)
- [License &amp; Commercial Terms](#license--commercial-terms)

Features and Terminology
------------------------

[](#features-and-terminology)

- **Account** – application user account.
- **Identity** – provider &amp; provider\_user\_id.
- **Register** – create a new account with a new identity linked to it.
- **Connect** – link a new identity to the current account.
- **Disconnect** – unlink an existing identity from the current account.
- **Transfer** – unlink an existing identity from one account and link it to the current one.
- **Automatic account** – an account created programmatically, e.g. during data import, that has never been logged into; `created_by` equals its own `id` and `logged_at` is `null`.

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

[](#installation)

1. Install the package via Composer:

    ```
    composer require internetguru/laravel-user
    ```
2. Publish and run the migration files:

    ```
    php artisan vendor:publish --provider="InternetGuru\LaravelUser\LaravelUserServiceProvider" --tag="ig-user:migrations"
    php artisan migrate
    ```
3. Set required session configuration in `config/session.php`:

    ```
    'expire_on_close' => true,
    'lifetime' => 120,
    ```

    The service provider throws an exception in debug mode or logs a warning in production if these values are not set correctly.

Configuration
-------------

[](#configuration)

### Environment Variables

[](#environment-variables)

VariableDefaultDescription`GOOGLE_CLIENT_ID`—Google OAuth client ID`GOOGLE_CLIENT_SECRET`—Google OAuth client secret`GOOGLE_REDIRECT_URI`—Google OAuth redirect URI`SEZNAM_CLIENT_ID`—Seznam OAuth client ID`SEZNAM_CLIENT_SECRET`—Seznam OAuth client secret`SEZNAM_REDIRECT_URI`—Seznam OAuth redirect URI`AUTH_LOGIN_ENABLED``true`Set to `false` to disable login — all login entry points return 404`AUTH_DEMO``false`Enable demo login — no password, user selected from list`LANG_DOMAINS``""`Comma-separated `lang:domain` pairs, e.g. `cs:example.cz,da:example.dk`### Disabling a Provider

[](#disabling-a-provider)

Set `enabled` to `false` in `config/services.php` for any provider to hide it from all login/connect buttons:

```
'google' => [
    'enabled' => false,
    ...
],
```

Roles
-----

[](#roles)

The package ships with a five-level `Role` enum. Applications can override `User::roles()` to return a custom enum.

RoleLevelIcon`CUSTOMER`10`fa-user``OPERATOR`20`fa-user-nurse``AUDITOR`30`fa-user-shield``MANAGER`40`fa-user-tie``ADMIN`50`fa-user-gear`Each case exposes `level()`, `icon()`, and `translation()` methods.

### Dynamic Role Checks

[](#dynamic-role-checks)

The `User` model provides magic `is{Role}()` and `is{Role}Plus()` methods based on the configured roles enum:

```
$user->isAdmin();         // true if role === ADMIN
$user->isManagerPlus();   // true if role level >= MANAGER level
$user->isOperatorPlus();  // true if role level >= OPERATOR level
```

### Role Helpers

[](#role-helpers)

```
User::roles()::cases();        // all Role cases
User::publicRolesArray();      // all cases except ADMIN
User::roleOptions();           // [['id' => 'manager', 'name' => 'Manager'], ...]
```

Socialite Providers
-------------------

[](#socialite-providers)

Built-in providers: **Google** and **Seznam**. Any other Socialite-compatible provider can be added by the application.

The `socialite.action` route accepts a `provider` and an `action`: `login`, `loginAndConnect`, `register`, `connect`, or `disconnect`. Use `socialite.callback` for the OAuth return URL.

### Routes

[](#routes)

Route nameURIDescription`login`GET `/login`Unified login page`logout`GET `/logout`Log out`pin-login.form`POST `/pin-login/send`Send PIN email`pin-login.verify`GET `/pin-login/verify`Show PIN entry form`pin-login.verify.submit`POST `/pin-login/verify`Verify PIN — throttled: 5 per 10 minutes`socialite.action`GET `/socialite/{provider}/{action}`Redirect to provider`socialite.callback`GET `/socialite/{provider}/{action}/callback`Handle provider callback`users.index`GET `/users`User list — managers and above`users.show`GET `/users/{user}`User detail`users.update`POST `/users/{user}`Update name, email, phone, or role### Usage Examples

[](#usage-examples)

```
{{-- Socialite login/register/connect buttons --}}

{{-- Direct disconnect link --}}
Disconnect Google
```

Disabling Login
---------------

[](#disabling-login)

Set `AUTH_LOGIN_ENABLED=false` to close all ways in — `/login`, `/register`, `/pin-login`, the PIN endpoints and socialite `login`/`register` all return 404. Routes stay registered, so `route('login')` keeps resolving in host apps and views.

```
AUTH_LOGIN_ENABLED=false
```

Logout, the `users` routes and socialite `connect`/`disconnect` remain available, so already authenticated sessions keep working. The `x-ig-user::user-menu` component hides its login link.

Demo Mode
---------

[](#demo-mode)

Set `AUTH_DEMO=true` to enable demo login. The login page switches to `login-demo` view, which lists all non-automatic users sorted by role from highest to lowest for one-click login — no password required. Useful for staging environments.

```
AUTH_DEMO=true
```

The list is provided by `User::getDemoUsers()`, which returns all non-automatic users sorted by role level descending.

PIN Login
---------

[](#pin-login)

PIN login allows users to authenticate with a 6-digit PIN sent to their email address. The PIN is prefixed with `IG-` in the UI, for example `IG-123456`.

### Flow

[](#flow)

1. User submits their email on the unified `/login` page.
2. The server sends a PIN email and redirects to `/pin-login/verify`.
3. User enters the PIN in the 6-box input; a hidden field assembles the full value.
4. On success, the user is logged in and redirected.

### Settings

[](#settings)

SettingValuePIN lifetime10 minutesResend throttle1 minuteVerify throttle5 attempts per 10 minutesPIN format`IG-` prefix + 6-digit numeric code### Send Form Options

[](#send-form-options)

- **Remember me** – persists the session beyond the browser close.
- **Create account if not found** – when checked, a new account is created for unknown emails.

### reCAPTCHA

[](#recaptcha)

The PIN send form is protected by reCAPTCHA v3. Ensure `laravel-common` reCAPTCHA is configured.

Language and Locale
-------------------

[](#language-and-locale)

The `SetAppLocale` middleware, registered automatically in the `web` group, handles language detection and persistence.

### Priority Order

[](#priority-order)

1. Explicit `?lang=` query parameter.
2. Authenticated user's `lang` column.
3. Session-stored locale.
4. Browser `Accept-Language` header — Slovak falls back to Czech if Czech is configured.
5. `app.locale` config default.

### Lang Domains

[](#lang-domains)

Map languages to dedicated domains via `LANG_DOMAINS`:

```
LANG_DOMAINS=cs:example.cz,da:example.dk
```

- Requests on a lang domain always enforce that domain's language.
- When a user switches to a language that has a dedicated domain, they are redirected there.
- When a user switches to a language without a dedicated domain while on a lang domain, they are redirected to `app.www`.

Language is saved to the authenticated user's `lang` column on every explicit change.

User Management
---------------

[](#user-management)

The package provides a user list at `/users` and a user detail page at `/users/{user}`, built on `laravel-model-browser`. Access is controlled by `UserPolicy`.

Users can update their own `name`, `email`, `phone`, and `role` via POST to `/users/{user}`. Role changes are subject to the `setRole` policy.

### Automatic Accounts

[](#automatic-accounts)

An account is considered *automatic* when `created_by === id` and `logged_at IS NULL`. These accounts are hidden from `User::summary()` and `getDemoUsers()`. When a user registers via PIN login with the "create account" option, reusing an existing automatic account converts it to a regular account.

Blade Components
----------------

[](#blade-components)

### ``

[](#x-ig-userbuttons)

Renders socialite provider buttons for a given action.

PropDefaultDescription`providers``User::providers()::enabledCases()`List of enabled providers`action``ProviderAction::LOGIN`Action: login, register, connect`prev_url``User::getPreviousUrl()`URL to redirect to after auth`showRemember``false`Show "Remember me" checkbox`disabled``false`Disable all buttons### ``

[](#x-ig-useruser-menu)

Dropdown menu for authenticated users showing name, role icon, link to user detail, and logout. Shows a login link for guests.

### ``

[](#x-ig-userpin-input)

Alpine.js-powered 6-box PIN input with paste, backspace, and arrow key support.

PropDefaultDescription`name``'pin'`Hidden input field name`length``6`Number of digit boxes`prefix``'IG-'`Visual prefix labelUser Preferences
----------------

[](#user-preferences)

The `user_preferences` table provides a simple key-value store per user.

```
$user->setPreference('theme', 'dark');
$theme = $user->getPreference('theme', 'light'); // 'dark'
```

Association History
-------------------

[](#association-history)

The `User` model uses the `AssociationHistory` trait from `laravel-common`. Changes to the following fields are tracked automatically:

`name`, `email`, `phone`, `role`, `lang`, `socialite`

The history is displayed on the user detail page, visible to managers and above.

User Policy
-----------

[](#user-policy)

GateDescription`crud`User can edit themselves; admins can edit all; managers can edit users with lower/equal roles`viewAny`Managers and above can view the user list`administrate`Managers and above`setRole`Admins can set any role; managers can set roles up to their own levelPublish the default policy to customise it:

```
php artisan vendor:publish --provider="InternetGuru\LaravelUser\LaravelUserServiceProvider" --tag="ig-user:policies"
```

IgUserSeeder
------------

[](#iguserseeder)

The package ships with `IgUserSeeder` for seeding the Internet Guru team accounts with Google/Seznam socialites and `ADMIN` role. Use it in your `DatabaseSeeder`:

```
$this->call(\InternetGuru\LaravelUser\Database\Seeders\IgUserSeeder::class);
```

Publishing
----------

[](#publishing)

TagDestinationDescription`ig-user:migrations``database/migrations/`Database migrations`ig-user:translations``lang/vendor/ig-user/`Language files — cs, en, da`ig-user:views``resources/views/vendor/ig-user/`Blade views`ig-user:policies``app/Policies/`UserPolicy```
php artisan vendor:publish --provider="InternetGuru\LaravelUser\LaravelUserServiceProvider" --tag="ig-user:translations"
php artisan vendor:publish --provider="InternetGuru\LaravelUser\LaravelUserServiceProvider" --tag="ig-user:views"
```

E2E Tests
---------

[](#e2e-tests)

The package includes Playwright E2E tests via `laravel-common` test helpers. Register them in your Playwright config:

```
import { registerUserTests } from 'path/to/laravel-user/e2e';

registerUserTests(test, { languages: ['en', 'cs'], demo: true });
```

### Options

[](#options)

OptionTypeDescription`languages``string[]`Languages to test — login/logout per language`demo``boolean`Include demo login flow testsLicense &amp; Commercial Terms
------------------------------

[](#license--commercial-terms)

### License

[](#license)

Copyright © 2026 **Internet Guru**

This software is licensed under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/) license.

> **Disclaimer:** This software is provided "as is", without warranty of any kind, express or implied. In no event shall the authors or copyright holders be liable for any claim, damages or other liability.

### Commercial Use

[](#commercial-use)

The standard CC BY-NC-SA license prohibits commercial use. If you wish to use this software in a commercial environment or product, we offer **flexible commercial licenses** tailored to:

- Your company size.
- The nature of your project.
- Your specific integration needs.

**Note:** In many instances, especially for startups or small-scale tools, this may result in no fees being charged at all. Please contact us to obtain written permission or a commercial agreement.

**Contact for Licensing:**

### Professional Services

[](#professional-services)

Are you looking to get the most out of this project? We are available for:

- **Custom Development:** Tailoring the software to your specific requirements.
- **Integration &amp; Support:** Helping your team implement and maintain the solution.
- **Training &amp; Workshops:** Seminars and hands-on workshops for your developers.

Reach out to us at  — we are more than happy to assist you!

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance94

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 93% 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 ~4 days

Total

163

Last Release

29d ago

Major Versions

v3.0.0 → v4.0.02025-12-02

v4.2.11 → v5.0.02026-02-04

v5.3.1 → v6.0.02026-02-25

v4.2.12 → v6.2.12026-03-15

v6.7.2 → v7.0.02026-06-03

PHP version history (2 changes)v0.1.0PHP ^8.0

v4.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/b52abb7d16d42d5abe09b797fc4da8186dc507caf8a62f4e1b88b0448edca4f8?d=identicon)[internetguru](/maintainers/internetguru)

---

Top Contributors

[![petrzpav](https://avatars.githubusercontent.com/u/1113912?v=4)](https://github.com/petrzpav "petrzpav (1059 commits)")[![jiripavelka](https://avatars.githubusercontent.com/u/17675046?v=4)](https://github.com/jiripavelka "jiripavelka (80 commits)")

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[unopim/unopim

UnoPim Laravel PIM

10.8k2.5k](/packages/unopim-unopim)[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

11.3k4.0k](/packages/leantime-leantime)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.8k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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