PHPackages                             whilesmart/laravel-user-authentication - 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. whilesmart/laravel-user-authentication

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

whilesmart/laravel-user-authentication
======================================

Package for managing user authentication across our projects

v1.0.5(4mo ago)21.1k↑62.5%1[3 issues](https://github.com/whilesmartphp/laravel-user-authentication/issues)[2 PRs](https://github.com/whilesmartphp/laravel-user-authentication/pulls)MITPHPCI passing

Since Mar 7Pushed 2mo agoCompare

[ Source](https://github.com/whilesmartphp/laravel-user-authentication)[ Packagist](https://packagist.org/packages/whilesmart/laravel-user-authentication)[ RSS](/packages/whilesmart-laravel-user-authentication/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelog (4)Dependencies (9)Versions (32)Used By (0)

Laravel User Authentication Package
===================================

[](#laravel-user-authentication-package)

A comprehensive Laravel authentication package with support for registration, login, password reset, OAuth integration, and configurable email/phone verification.

Features
--------

[](#features)

- **Complete Authentication System:**

    - User registration with customizable fields
    - Login with email, phone, or username
    - Password reset functionality
    - OAuth integration (Google, Apple, etc.)
- **Email/Phone Verification:**

    - Configurable verification before registration
    - Event-driven integration with any email/SMS provider
    - Built-in SmartPings integration for managed verification
    - Rate limiting and security features
    - 5-minute code expiry (configurable)
- **Developer-Friendly:**

    - OpenAPI documentation with PHP attributes
    - Customizable response formatting
    - Middleware hooks for custom logic
    - Event system for extensibility
- **Security Features:**

    - Backend verification validation
    - Rate limiting protection
    - Secure code generation and storage

Quick Start
-----------

[](#quick-start)

```
composer require whilesmart/laravel-user-authentication
php artisan migrate
```

That's it! The package will auto-register routes and work out of the box.

**📖 [Full Installation Guide](docs/installation.md)**

Email/Phone Verification
------------------------

[](#emailphone-verification)

### Option 1: SmartPings Integration (Managed)

[](#option-1-smartpings-integration-managed)

For hassle-free verification with SmartPings handling the entire flow:

```
# .env
USER_AUTH_REQUIRE_EMAIL_VERIFICATION=true
USER_AUTH_REQUIRE_PHONE_VERIFICATION=false
USER_AUTH_VERIFICATION_PROVIDER=smartpings
USER_AUTH_SELF_MANAGED=false
USER_AUTH_ROUTE_PREFIX=api

SMARTPINGS_CLIENT_ID=your-client-id
SMARTPINGS_SECRET_ID=your-secret-id
```

All configuration is now environment-driven for better deployment flexibility.

### Option 2: Custom Provider (Self-Managed)

[](#option-2-custom-provider-self-managed)

Set up email or phone verification with event-driven integration:

```
# .env
USER_AUTH_REQUIRE_EMAIL_VERIFICATION=true
USER_AUTH_REQUIRE_PHONE_VERIFICATION=false
USER_AUTH_VERIFICATION_PROVIDER=default
USER_AUTH_SELF_MANAGED=true
USER_AUTH_CODE_LENGTH=6
USER_AUTH_CODE_EXPIRY_MINUTES=5
USER_AUTH_RATE_LIMIT_ATTEMPTS=3
USER_AUTH_RATE_LIMIT_MINUTES=5
USER_AUTH_ROUTE_PREFIX=api
```

Create event listeners to send codes via your preferred provider:

```
class SendVerificationCodeEmailListener {
    public function handle(VerificationCodeGeneratedEvent $event) {
        Mail::raw("Your code: {$event->code}", function($msg) use ($event) {
            $msg->to($event->contact)->subject('Verification Code');
        });
    }
}
```

**📖 [Complete Verification Setup Guide](docs/verification.md)**

Environment Variables
---------------------

[](#environment-variables)

All package configuration is now environment-driven. Add these variables to your `.env` file:

### Core Settings

[](#core-settings)

```
# Route prefix for all authentication endpoints (default: api)
USER_AUTH_ROUTE_PREFIX=api
```

### Verification Settings

[](#verification-settings)

```
# Email verification (default: false)
USER_AUTH_REQUIRE_EMAIL_VERIFICATION=false

# Phone verification (default: false)
USER_AUTH_REQUIRE_PHONE_VERIFICATION=false

# Verification provider: 'default' or 'smartpings' (default: default)
USER_AUTH_VERIFICATION_PROVIDER=default

# Self-managed verification (default: true)
# Set to false when using SmartPings to let them handle the flow
USER_AUTH_SELF_MANAGED=true

# Verification code length (default: 6)
USER_AUTH_CODE_LENGTH=6

# Code expiry time in minutes (default: 5)
USER_AUTH_CODE_EXPIRY_MINUTES=5

# Rate limiting attempts before blocking (default: 3)
USER_AUTH_RATE_LIMIT_ATTEMPTS=3

# Rate limiting window in minutes (default: 5)
USER_AUTH_RATE_LIMIT_MINUTES=5
```

### SmartPings Integration

[](#smartpings-integration)

```
# Required when USER_AUTH_VERIFICATION_PROVIDER=smartpings
SMARTPINGS_CLIENT_ID=your-client-id
SMARTPINGS_SECRET_ID=your-secret-id
```

Available Endpoints
-------------------

[](#available-endpoints)

- `POST /api/register` - Register a new user
- `POST /api/login` - User login
- `POST /api/logout` - User logout
- `POST /api/send-verification-code` - Send verification code
- `POST /api/verify-code` - Verify submitted code
- `POST /api/password/reset-code` - Request password reset
- `POST /api/password/reset` - Reset password
- `GET /api/oauth/{provider}/login` - OAuth login
- `GET /api/oauth/{provider}/callback` - OAuth callback
- `POST /api/oauth/firebase/{provider}/callback` - Firebase OAuth callback. See the [Laravel Firebase Package](https://github.com/kreait/laravel-firebase) for Firebase configurations.

Events
------

[](#events)

The package dispatches events for extensibility:

- `UserRegisteredEvent` - After successful registration
- `UserLoggedInEvent` - After successful login
- `UserLoggedOutEvent` - After logout
- `VerificationCodeGeneratedEvent` - When verification codes are generated
- `PasswordResetCodeGeneratedEvent` - When password reset codes are generated
- `PasswordResetCompleteEvent` - After password reset

OpenAPI Documentation
---------------------

[](#openapi-documentation)

To include the authentication endpoints in your OpenAPI specification, publish the documentation class:

```
php artisan vendor:publish --provider="Whilesmart\UserAuthentication\UserAuthenticationServiceProvider" --tag="laravel-user-authentication-docs"
```

This will create `app/Http/Documentation/UserAuthOpenApiDocs.php` containing all OpenAPI attributes for the authentication endpoints. Your OpenAPI generator will automatically discover and include these endpoints.

### Alternative: Publish specific tags

[](#alternative-publish-specific-tags)

```
# Publish only documentation
php artisan vendor:publish --tag="laravel-user-authentication-docs"

# Publish only configuration
php artisan vendor:publish --tag="laravel-user-authentication-config"

# Publish everything
php artisan vendor:publish --provider="Whilesmart\UserAuthentication\UserAuthenticationServiceProvider"
```

Documentation
-------------

[](#documentation)

- **📖 [Installation Guide](docs/installation.md)** - Complete installation instructions
- **📖 [Email/Phone Verification](docs/verification.md)** - Set up verification with any provider
- **📖 [Customization Guide](docs/customization.md)** - Response formatting, middleware hooks

Development Commands
--------------------

[](#development-commands)

- `composer test` - Run unit tests
- `composer phpmd` - Run Mess Detector checks
- `composer phpstan` - Run Static Analysis checks
- `composer phpcs` - Run PHP code style checks
- `composer pint` - Run Laravel code style checks
- `composer openapi` - Run open api documentation generation

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance63

Regular maintenance activity

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~59 days

Total

6

Last Release

128d ago

### Community

Maintainers

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

---

Top Contributors

[![nfebe](https://avatars.githubusercontent.com/u/14317775?v=4)](https://github.com/nfebe "nfebe (35 commits)")[![kofimokome](https://avatars.githubusercontent.com/u/21100923?v=4)](https://github.com/kofimokome "kofimokome (32 commits)")[![iMercyvlogs](https://avatars.githubusercontent.com/u/111022500?v=4)](https://github.com/iMercyvlogs "iMercyvlogs (4 commits)")

---

Tags

authauthenticationlaravellaravel-packagesanctumsmartpings

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[socialiteproviders/manager

Easily add new or override built-in providers in Laravel Socialite.

42542.0M544](/packages/socialiteproviders-manager)[dutchcodingcompany/filament-socialite

Social login for Filament through Laravel Socialite

213914.9k9](/packages/dutchcodingcompany-filament-socialite)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

34450.0k2](/packages/andrewdwallo-filament-companies)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6712.1k2](/packages/hasinhayder-tyro)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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