PHPackages                             mindtwo/px-user-laravel - 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. [Framework](/categories/framework)
4. /
5. mindtwo/px-user-laravel

ActiveLibrary[Framework](/categories/framework)

mindtwo/px-user-laravel
=======================

Package for handling PX User authentication for Laravel.

4.1.4(1w ago)03[1 issues](https://github.com/mindtwo/px-user-laravel/issues)MITPHPPHP ^8.4|^8.5

Since Nov 21Pushed 1w ago3 watchersCompare

[ Source](https://github.com/mindtwo/px-user-laravel)[ Packagist](https://packagist.org/packages/mindtwo/px-user-laravel)[ Docs](https://github.com/mindtwo/px-user-laravel)[ RSS](/packages/mindtwo-px-user-laravel/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (85)Versions (139)Used By (0)

Laravel PX-User Package
=======================

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/5772c94a327e20c4ab1e329ebdc9b8d6b0fbadceb9f2487e8acc6ad4404dc492/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696e6474776f2f70782d757365722d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mindtwo/px-user-laravel)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/fa045b51be033a0412ce7cb7eb442e35e23057c1e1761ad0f49ce11be655b585/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696e6474776f2f70782d757365722d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mindtwo/px-user-laravel)

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

[](#installation)

You can install the package via composer:

```
composer require mindtwo/px-user-laravel
```

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

[](#how-to-use)

### Publish config

[](#publish-config)

To publish the modules config file simply run

```
php artisan vendor:publish px-user
```

This publishes the `px-user.php` config file to your projects config folder.

### Configure the package

[](#configure-the-package)

After that you should add the following keys to your .env-file:

- PX\_USER\_M2M
- PX\_USER\_TENANT
- PX\_USER\_DOMAIN

This keys will auto populate the respective config values.

Inside your configuration you will also find the keys:

`stage` which will use your APP\_ENV variable and `px_user_cache_time` which simply determines for how long the package is allowed to cache the user data in minutes.

### Prepare the User model

[](#prepare-the-user-model)

First you will need to add a column `px_user_id` to your users table. This value is used to retrieve the cached user data.

This is necessary since PX User only allows us to cache the user data and not to store them inside a database, we rely on caching the data. This is done using Laravel `Cache` facade. To seemlessly integrate the data for use with your `User` model the package provides a trait.

```
use mindtwo\PxUserLaravel\Traits\UseUserDataCache;

class User extends Model
{
    use UseUserDataCache;
}
```

This trait overrides the models `getAttribute($name)` method so you can use `$user->lastname`even though there is no lastname column inside your users table.

### Login a user

[](#login-a-user)

To login a user the package provides an action called `PxUserLoginAction`. Utilize this action inside a controller to retrieve the user data from PX Users api.

An example for such a controller is given below:

```
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use mindtwo\PxUserLaravel\Actions\PxUserLoginAction;

class LoginController extends Controller
{
    public function __construct(
        protected PxUserLoginAction $pxUserLoginAction,
    ) {
    }

    /**
     * @param  Request  $request
     * @return \Illuminate\Http\JsonResponse
     *
     * @throws Exception
     */
    public function login(Request $request)
    {
        // received token auth data via PX User widgets
        $tokenData = $request->only([
            'access_token',
            'access_token_lifetime_minutes',
            'access_token_expiration_utc',
            'refresh_token',
            'refresh_token_lifetime_minutes',
            'refresh_token_expiration_utc',
        ]);

        $result = $this->pxUserLoginAction->execute($tokenData);

        return response()->json(['success' => $result]);
    }
}
```

If the value for `$result` is true you can now access authenticated user via Laravel's `Auth` facade.

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [mindtwo GmbH](https://github.com/mindtwo)
- [All Other Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance98

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 93.3% 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 ~11 days

Total

120

Last Release

11d ago

Major Versions

0.10.3 → 1.02023-05-12

1.9.1 → 2.02024-03-12

1.9.2.x-dev → 2.52024-05-28

2.12.0 → 3.0.02025-11-17

3.0.1 → 4.0.02026-02-16

PHP version history (6 changes)0.1PHP ^8.0

1.0PHP ^8.0|^8.1

2.0.1PHP ^8.0|^8.1|^8.2

2.10.0PHP ^8.0|^8.1|^8.2|^8.3|^8.4

4.0.0PHP ^8.4

4.0.1PHP ^8.4|^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cc86fe6179314d204b14d1c81eb09a87ef84b0bcf2360dcd981171d1346c077?d=identicon)[mindtwo](/maintainers/mindtwo)

---

Top Contributors

[![blumewas](https://avatars.githubusercontent.com/u/5960093?v=4)](https://github.com/blumewas "blumewas (196 commits)")[![jonasemde](https://avatars.githubusercontent.com/u/5083193?v=4)](https://github.com/jonasemde "jonasemde (12 commits)")[![lau87](https://avatars.githubusercontent.com/u/11555499?v=4)](https://github.com/lau87 "lau87 (2 commits)")

---

Tags

frameworklaravelloginpx-uservnr

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

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

Larament is a time-saving starter kit to quickly launch Laravel 13.x projects. It includes FilamentPHP 5.x pre-installed and configured, along with additional tools and features to streamline your development workflow.

3891.8k](/packages/codewithdennis-larament)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[nunomaduro/laravel-starter-kit-inertia-react

The skeleton application for the Laravel framework.

2071.1k](/packages/nunomaduro-laravel-starter-kit-inertia-react)[ercogx/laravel-filament-starter-kit

This is a Filament v5 Starter Kit for Laravel 13, designed to accelerate the development of Filament-powered applications.

461.7k](/packages/ercogx-laravel-filament-starter-kit)

PHPackages © 2026

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