PHPackages                             properos/laravel-users - 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. properos/laravel-users

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

properos/laravel-users
======================

Users package

v1.1.0(3w ago)068MITPHP

Since Jun 1Pushed 3w ago3 watchersCompare

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

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

Properos Users Package
======================

[](#properos-users-package)

Laravel 11 package for user management, authentication, authorization (roles &amp; permissions), and user profiles.

Requirements
------------

[](#requirements)

- **Laravel**: 11.x
- **PHP**: 8.2+
- **Database**: MySQL 5.7+ or MariaDB 10.3+

Dependencies
------------

[](#dependencies)

This package requires the following packages:

PackageVersionPurpose`laravel/sanctum`^4.0API authentication`intervention/image`^3.0Image processing (avatars, uploads)`intervention/image-laravel`^1.0Laravel integration for Intervention Image`laravel/ui`^4.0Authentication scaffolding`laravel/socialite`^5.0Social authentication (optional)Installation
------------

[](#installation)

### 1. Install the package

[](#1-install-the-package)

```
composer require properos/laravel-users
```

### 2. Publish configuration files

[](#2-publish-configuration-files)

```
php artisan vendor:publish --provider="Properos\Users\UsersServiceProvider"
```

### 3. Run migrations

[](#3-run-migrations)

```
php artisan migrate
```

This will create the following tables:

- `users`
- `user_addresses`
- `user_profiles`
- `roles`
- `permissions`
- `user_roles`
- `user_permissions`
- `role_permissions`
- `api_credentials`
- `user_activity_logs`

### 4. Run seeders (optional)

[](#4-run-seeders-optional)

Add the following to `database/seeders/DatabaseSeeder.php`:

```
use Properos\Users\Database\Seeders\RolesPermissionsTableSeeder;
use Properos\Users\Database\Seeders\UsersTableSeeder;

public function run(): void
{
    $this->call([
        RolesPermissionsTableSeeder::class,
        UsersTableSeeder::class,
    ]);
}
```

Then run:

```
php artisan db:seed
```

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

[](#configuration)

### 1. Database Configuration

[](#1-database-configuration)

In `config/database.php`, ensure MySQL configuration uses:

```
'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', '127.0.0.1'),
    'port' => env('DB_PORT', '3306'),
    'database' => env('DB_DATABASE', 'forge'),
    'username' => env('DB_USERNAME', 'forge'),
    'password' => env('DB_PASSWORD', ''),
    'unix_socket' => env('DB_SOCKET', ''),
    'charset' => 'utf8',
    'collation' => 'utf8_general_ci',
    'prefix' => '',
    'strict' => true,
    'engine' => 'InnoDB',
],
```

### 2. Authentication Configuration

[](#2-authentication-configuration)

In `config/auth.php`, update the guards and providers:

```
'guards' => [
    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver' => 'sanctum',
        'provider' => 'users',
    ],
],

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => \Properos\Users\Models\User::class,
    ],
],
```

### 3. Service Providers

[](#3-service-providers)

In `config/app.php`, add to the `providers` array:

```
Laravel\Socialite\SocialiteServiceProvider::class,
```

### 4. Middleware Registration

[](#4-middleware-registration)

In `app/Http/Kernel.php`, register the middleware:

```
'role' => \Properos\Users\Middlewares\RoleMiddleware::class,
'permission' => \Properos\Users\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Properos\Users\Middlewares\RoleOrPermissionMiddleware::class,
```

### 5. Social Authentication (Optional)

[](#5-social-authentication-optional)

If you want to enable social authentication (Facebook, Google), install Socialite:

```
composer require laravel/socialite
```

Add to `config/services.php`:

```
'facebook' => [
    'client_id' => env('FACEBOOK_CLIENT_ID'),
    'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
    'redirect' => env('FACEBOOK_CALLBACK', 'http://your-app.com/auth/facebook/callback')
],

'google' => [
    'client_id' => env('GOOGLE_CLIENT_ID'),
    'client_secret' => env('GOOGLE_CLIENT_SECRET'),
    'redirect' => env('GOOGLE_CALLBACK', 'http://your-app.com/auth/google/callback')
],
```

Add to your `.env`:

```
FACEBOOK_CLIENT_ID=your-app-id
FACEBOOK_CLIENT_SECRET=your-app-secret
FACEBOOK_CALLBACK=http://your-app.com/auth/facebook/callback

GOOGLE_CLIENT_ID=your-app-id
GOOGLE_CLIENT_SECRET=your-app-secret
GOOGLE_CALLBACK=http://your-app.com/auth/google/callback
```

### 6. Environment Variables

[](#6-environment-variables)

Add to your `.env`:

```
# Laravel Mix / Vite
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

MIX_HOST="${DOMAIN}"
MIX_API_BASE_URL=
MIX_CDN_URL=

MIX_ADMIN_WEB_PREFIX='/admin'
MIX_ADMIN_WEB_API_PREFIX='/api/admin'
```

Asset Compilation
-----------------

[](#asset-compilation)

### 1. Install npm dependencies

[](#1-install-npm-dependencies)

```
npm install
npm install moment --save
```

### 2. Configure webpack.mix.js

[](#2-configure-webpackmixjs)

Add to `webpack.mix.js`:

```
.js('resources/assets/js/be/modules/users/js/user.js', 'public/be/js/modules/user.js')
```

### 3. Configure bootstrap.js

[](#3-configure-bootstrapjs)

In `resources/assets/bootstrap.js`, add:

```
import Helpers from './misc/helpers'

window.moment = require('moment')
window.Vue = require('vue');
window.Helpers = Helpers;
```

### 4. Compile assets

[](#4-compile-assets)

```
npm run watch
# or
npm run prod
```

Usage
-----

[](#usage)

### Using Models

[](#using-models)

```
use Properos\Users\Models\User;
use Properos\Users\Models\Role;
use Properos\Users\Models\Permission;

// Get all users
$users = User::all();

// Find user by ID
$user = User::find(1);

// Get user roles
$roles = $user->roles;

// Get user permissions
$permissions = $user->permissions;
```

### Using Routes

[](#using-routes)

Add to `routes/web.php`:

```
use Illuminate\Support\Facades\Route;

Route::get('/admin/dashboard', function(){
    return view('be.index');
})->middleware(['auth', 'role:admin']);

Route::get('/admin/users', [UserController::class, 'index'])
    ->middleware(['auth', 'permission:users.view']);
```

### Using Middleware

[](#using-middleware)

```
// Role-based
Route::middleware(['role:admin'])->group(function () {
    // Admin only routes
});

// Permission-based
Route::middleware(['permission:users.edit'])->group(function () {
    // Users edit only routes
});

// Role OR Permission
Route::middleware(['role_or_permission:super-admin'])->group(function () {
    // Routes accessible by super-admin role OR super-admin permission
});
```

### Using Classes

[](#using-classes)

```
use Properos\Users\Classes\CUser;

$cuser = new CUser();

// Create user
$user = $cuser->create([
    'firstname' => 'John',
    'lastname' => 'Doe',
    'email' => 'john@example.com',
    'password' => 'password123',
    'avatar' => $uploadedFile // Optional UploadedFile
]);

// Assign role
$cuser->assignRole([
    'user_id' => $user->id,
    'role_id' => 1
]);

// Assign permission
$cuser->assignPermission([
    'user_id' => $user->id,
    'permission_id' => 1
]);

// Change password
$cuser->changePassword([
    'user_id' => $user->id,
    'password' => 'newpassword123',
    'password_confirmation' => 'newpassword123'
]);
```

Features
--------

[](#features)

### User Management

[](#user-management)

- Create, read, update, delete users
- User profiles and addresses
- Avatar upload and processing
- User activity logging

### Authentication

[](#authentication)

- Email/password authentication
- Social authentication (Facebook, Google)
- Password reset
- API authentication via Sanctum

### Authorization

[](#authorization)

- Role-based access control (RBAC)
- Permission-based access control
- Flexible role/permission assignment
- Middleware for route protection

### User Profile

[](#user-profile)

- First name, last name, email, phone
- Company information
- Avatar management
- Address management

### Activity Logging

[](#activity-logging)

- Automatic user activity tracking
- Login/logout logging
- Custom action logging

Troubleshooting
---------------

[](#troubleshooting)

### Migration errors

[](#migration-errors)

If you get migration errors about duplicate tables:

```
php artisan migrate:rollback --step=1
# Then check if tables exist and drop them if needed
php artisan migrate
```

### Service provider not found

[](#service-provider-not-found)

Make sure the service provider is registered in `config/app.php`:

```
Properos\Users\UsersServiceProvider::class,
```

### Middleware not working

[](#middleware-not-working)

Ensure middleware is registered in `app/Http/Kernel.php` with the correct aliases.

### Image upload not working

[](#image-upload-not-working)

1. Check that `intervention/image` and `intervention/image-laravel` are installed
2. Ensure the `public` disk is configured in `config/filesystems.php`
3. Check file permissions on storage/app/public

### Vue components not rendering

[](#vue-components-not-rendering)

1. Ensure assets are compiled: `npm run prod`
2. Check that webpack.mix.js is configured correctly
3. Verify that bootstrap.js includes the required dependencies

### Sanctum authentication not working

[](#sanctum-authentication-not-working)

1. Ensure `laravel/sanctum` is installed
2. Run `php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"`
3. Add `Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful` to `app/Http/Kernel.php`
4. Configure stateful domains in `config/sanctum.php`

Breaking Changes from Previous Versions
---------------------------------------

[](#breaking-changes-from-previous-versions)

- **Laravel Version**: Requires Laravel 11.x (minimum)
- **PHP Version**: Requires PHP 8.2+
- **Intervention Image**: Updated to v3 with new API
- **Database Collation**: Default collation is now `utf8_general_ci`

License
-------

[](#license)

MIT License. See LICENSE file for details.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance94

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Total

3

Last Release

26d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c4369392b367c14bcd195185641dda7868b05f1401b6bfb8d31aaef366ba043?d=identicon)[properos](/maintainers/properos)

---

Top Contributors

[![raherediag](https://avatars.githubusercontent.com/u/10603112?v=4)](https://github.com/raherediag "raherediag (3 commits)")

---

Tags

laravelUsersproperos

### Embed Badge

![Health badge](/badges/properos-laravel-users/health.svg)

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[bagisto/bagisto

Bagisto Laravel E-Commerce

27.6k172.1k9](/packages/bagisto-bagisto)[sebastienheyd/boilerplate

Laravel Boilerplate based on AdminLTE 3 with blade components, user management, roles, permissions, logs viewer, ...

29420.1k3](/packages/sebastienheyd-boilerplate)[hasinhayder/tyro

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

6783.6k6](/packages/hasinhayder-tyro)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

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