PHPackages                             phpnomad/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. phpnomad/auth

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

phpnomad/auth
=============

1.0.2(3w ago)05.8k↓36.7%[3 PRs](https://github.com/phpnomad/auth/pulls)6MITPHPCI passing

Since Jun 2Pushed 2w ago2 watchersCompare

[ Source](https://github.com/phpnomad/auth)[ Packagist](https://packagist.org/packages/phpnomad/auth)[ Docs](https://github.com/phpnomad/core)[ RSS](/packages/phpnomad-auth/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (3)Dependencies (6)Versions (10)Used By (6)

phpnomad/auth
=============

[](#phpnomadauth)

[![Latest Version](https://camo.githubusercontent.com/3f378172f2aeec52fc5a10263725ff14b8f6dc68dfce3ddab5f6900e53c00b02/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068706e6f6d61642f617574682e737667)](https://packagist.org/packages/phpnomad/auth) [![Total Downloads](https://camo.githubusercontent.com/e97643677824981bbb3d6fc234c7a8fcdf76c14aabd5c7d4946ac7f5240c31d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706e6f6d61642f617574682e737667)](https://packagist.org/packages/phpnomad/auth) [![PHP Version](https://camo.githubusercontent.com/124b9edbe9c47d43d98ee804cec4ec630b5099b288d19bc61ddebd774d7f157b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068706e6f6d61642f617574682e737667)](https://packagist.org/packages/phpnomad/auth) [![License](https://camo.githubusercontent.com/490ac5e337446c9f642c46fa7aac7593cc51ae06ea570e379220b1bed0fddf82/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068706e6f6d61642f617574682e737667)](https://packagist.org/packages/phpnomad/auth)

`phpnomad/auth` is the authentication and authorization layer for [PHPNomad](https://phpnomad.com) applications. It defines the interfaces your code depends on (`JwtStrategy`, `HashStrategy`, `CurrentUserResolverStrategy`, `PasswordResetStrategy`, `SecretProvider`, and friends), a `User`/`Session`/`Action` domain model, an authorization policy evaluator, a `JwtService` with a fluent payload builder, and lifecycle events for login, logout, and permission initialization. Your application code talks to the interfaces, never to a platform's auth system directly.

Concrete implementations live outside this package. `phpnomad/firebase-jwt-integration` provides the production `JwtStrategy` using `firebase/php-jwt`. Platform integrations like `phpnomad/wordpress-integration` supply the user resolver, session, and password reset strategies for their host. Your own application fills in the gaps (a `SecretProvider` that reads from config, a custom `CurrentUserResolverStrategy` for a SaaS, and so on).

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

[](#installation)

```
composer require phpnomad/auth
```

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

[](#quick-start)

Authentication in PHPNomad is a set of interfaces you implement for your platform and then bind in your bootstrapper. A typical initializer maps each auth interface to a concrete class using the `HasClassDefinitions` contract from `phpnomad/loader`.

```
