PHPackages                             aerynl/reg-and-auth - 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. aerynl/reg-and-auth

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

aerynl/reg-and-auth
===================

Simple package for registering, activation, authentication and sending password reminders

5.2.x-dev(9y ago)383MITPHP

Since Mar 16Pushed 9y ago3 watchersCompare

[ Source](https://github.com/aerynl/reg-and-auth)[ Packagist](https://packagist.org/packages/aerynl/reg-and-auth)[ Docs](http://github.com/aerynl/reg-and-auth)[ RSS](/packages/aerynl-reg-and-auth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

reg-and-auth
============

[](#reg-and-auth)

Simple package for registering, activation, authentication and sending password reminders

Installing
----------

[](#installing)

- `composer require aerynl/reg-and-auth "dev-master"`
- `php artisan vendor:publish --provider="Aerynl\RegAuth\RegAuthServiceProvider"`
- `php artisan migrate`

2 and 3 will update database fields according to package requirements. It will insert the following fields (if they are not already present): `username`, `activated`, `activation_code`, `reset_password_code`. Also if `activated` field is just created, it will set all the current users as activated.

How to use
----------

[](#how-to-use)

### Login

[](#login)

#### by username and password

[](#by-username-and-password)

`$result = Aerynl\RegAuth\RegAuth::login($username, $password, $remember);`

`$username` and `$password` are required parameters, `$remember` is not required.

This function will check `$username` and `$password` for non-emptiness, find user by username or email, check if user is activated and log him in if everything is ok.

It will return `array('success' => false, 'message' => '...')` in case of fail and `array('success' => true)` in case of success.

#### by id

[](#by-id)

`$result = Aerynl\RegAuth\RegAuth::simpleLoginById($id);`

This function will check `$id` for non-emptiness, find user by id, check if user is activated and log him in if everything is ok.

It will return `array('success' => false, 'message' => '...')` in case of fail and `array('success' => true)` in case of success.

### Get User

[](#get-user)

`$user = Aerynl\RegAuth\RegAuth::getUser();`

Fetches currently authenticated user

Returns null if there is no user in session.

### Logout

[](#logout)

`Aerynl\RegAuth\RegAuth::logout();`

Logs out currently authenticated user

### Register

[](#register)

`$result = Aerynl\RegAuth\RegAuth::register($user_data);`

`$user_data` is array, which must have `email`, `password` and `password_confirmation`. It also may have another fields, which will be stored to `users` table.

This function will do the following:

- check `$user_data` for validity
- check if `password` and `password_confirmation` match
- check if there is no user with the same email or username
- register user
- generate activation\_code

It will return `array('success' => false, 'message' => '...')` in case of fail and `array('success' => true, 'user' => $user)` in case of success.

### Activate

[](#activate)

`$result = Aerynl\RegAuth\RegAuth::activate($hash);`

`$hash` is a string, containing activation code.

This function search for not activated user with `activation_code = $hash` and activates him.

It will return `array('success' => false, 'message' => '...')` in case of fail and `array('success' => true, 'user' => $user)` in case of success.

### Forgot password

[](#forgot-password)

`$result = Aerynl\RegAuth\RegAuth::generateForgotPassHash($username);`

This function will check `$username` for non-emptiness, find user by username or email and generate `reset_password_code`.

It will return `array('success' => false, 'message' => '...')` in case of fail and `array('success' => true, 'user' => $user)` in case of success.

### Forgot password step 2

[](#forgot-password-step-2)

`$result = Aerynl\RegAuth\RegAuth::processForgotPassHash($hash);`

This function search for user with `reset_password_code = $hash` and generates a new password for him.

It will return `array('success' => false, 'message' => '...')` in case of fail and `array('success' => true, 'user' => $user, 'new_pass' => $new_pass)` in case of success.

### Password generator

[](#password-generator)

`$pass = Aerynl\RegAuth\RegAuth::generatePass();`

Generates simple 6-number password

### Change password

[](#change-password)

`$result = Aerynl\RegAuth\RegAuth::changePass($pass_data, $user_id);`

`$pass_data` is array, which must have `old_password`, `new_password` and `password_confirmation`.

This function search for user with `id = $user_id`, checks if `$pass_data['old_password']` is correct, checks if `$pass_data['new_password']` and `$pass_data['password_confirmation']` match and saves new password if everything is ok.

It will return `array('success' => false, 'message' => '...')` in case of fail and `array('success' => true)` in case of success.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

Unknown

Total

1

Last Release

3573d ago

### Community

Maintainers

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

---

Top Contributors

[![aerynl](https://avatars.githubusercontent.com/u/11734601?v=4)](https://github.com/aerynl "aerynl (7 commits)")[![lespavl](https://avatars.githubusercontent.com/u/1397340?v=4)](https://github.com/lespavl "lespavl (7 commits)")

---

Tags

laravelauth

### Embed Badge

![Health badge](/badges/aerynl-reg-and-auth/health.svg)

```
[![Health](https://phpackages.com/badges/aerynl-reg-and-auth/health.svg)](https://phpackages.com/packages/aerynl-reg-and-auth)
```

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[codegreencreative/laravel-samlidp

Make your PHP Laravel application an Identification Provider using SAML 2.0. This package allows you to implement your own Identification Provider (idP) using the SAML 2.0 standard to be used with supporting SAML 2.0 Service Providers (SP).

263763.5k1](/packages/codegreencreative-laravel-samlidp)[pallant/laravel-aws-cognito-auth

An authentication driver for Laravel for authenticating users in AWS Cognito User Pools

777.7k](/packages/pallant-laravel-aws-cognito-auth)

PHPackages © 2026

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