Looking to hire Laravel developers? Try LaraJobs

auth-components-laravel maintained by dipeshsrv

Description
Reusable auth components for Laravel 12
Author
Last update
2025/06/16 01:19 (dev-main)
License
Links
Downloads
2

Comments
comments powered by Disqus

Laravel Auth Components

A reusable authentication package for Laravel 12+ that includes:

  • ✅ Sign Up (Registration)
  • ✅ Sign In (Login)
  • ✅ Forgot Password
  • ✅ Reset Password (with hashed email check)
  • ✅ Dashboard (Authenticated Route)

This package helps you quickly implement common authentication functionality into your Laravel app.


🚀 Installation

Step 1: Require the package

composer require dipeshsrv/auth-components-laravel  

🛠️ Setup Instructions

Step 2: Run Migrations

Publish the migration and run it:

php artisan vendor:publish --tag=authcomponents-migrations
php artisan migrate

This creates a users table with name, email, phone, and password.


Step 3: Publish Views (optional)

php artisan vendor:publish --tag=authcomponents-views

This copies the package views to:

resources/views/vendor/authcomponents/

You can customize them as needed.


Step 4: Routes Provided

These routes are automatically loaded via the package:

Method URI Name Description
GET /login login Show login form
POST /login Submit login
POST /logout logout Logout user
GET /register authcomponents.register.form Show registration form
POST /register authcomponents.register.submit Submit registration
GET /forgot-password password.request Show forgot password
POST /forgot-password password.email Send reset link email
GET /reset-password/{token} password.reset Show reset form
POST /reset-password password.update Submit new password
GET /dashboard dashboard Protected dashboard view

🔐 Security Enhancement – Hashed Email Verification

As part of the password reset process, this package adds a security enhancement:
It validates the email using a hashed SHA-256 value passed in the reset URL:

Example:

/reset-password/{token}?email=user@example.com&hash=hashed_value

The reset form will compare this hash with the actual email to protect from tampering.

Note: By default, the hash is generated and checked internally in the controller.
You don’t need to implement a custom notification unless you want to generate a custom URL format manually.


✅ Example Usage

Once installed and set up:

  • Visit /register to sign up a new user
  • Log in via /login
  • After login, you will be redirected to /dashboard
  • You can click Logout to end the session
  • Use /forgot-password to trigger password reset flow

📂 Directory Structure (inside the package)

auth-components-laravel/
├── src/
│   ├── Http/
│   │   └── Controllers/
│   ├── Database/
│   │   └── Migrations/
│   ├── resources/
│   │   └── views/
│   └── routes/
│       └── web.php
├── composer.json
├── README.md

🧪 Development Notes

This package is stored on GitLab and intended for internal reuse. If you clone and modify it, don’t forget to:

git tag v1.0.0
git push origin v1.0.0

And in your consuming Laravel project:

composer require dipeshsrv/auth-components-laravel:dev-main

🙋‍♂️ Author

Dipesh Jagtap
@dipeshsrv


📄 License

MIT License