PHPackages                             hyrioo/hyrnatic-authenticator - 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. hyrioo/hyrnatic-authenticator

ActiveLibrary

hyrioo/hyrnatic-authenticator
=============================

This is my package hyrnatic-authenticator

023PHP

Since Feb 8Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/hyrioo/hyrnatic-authenticator)[ Packagist](https://packagist.org/packages/hyrioo/hyrnatic-authenticator)[ RSS](/packages/hyrioo-hyrnatic-authenticator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b6bef8115e45cc99b751c0d87e659c86939c307887c5baefcd9f88b000704a6f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f687972696f6f2f6879726e617469632d61757468656e74696361746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hyrioo/hyrnatic-authenticator)[![GitHub Tests Action Status](https://camo.githubusercontent.com/1f13154d2de9e4257dd89debc45956c779058c9e68f2c456339680666a200f28/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f687972696f6f2f6879726e617469632d61757468656e74696361746f722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/hyrioo/hyrnatic-authenticator/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c535c7ff481392906da2197a7f4f359d29a73548a8266e26153707712fa6a408/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f687972696f6f2f6879726e617469632d61757468656e74696361746f722f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/hyrioo/hyrnatic-authenticator/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/dcd8395a91350d6d5726556ccfc222164f489185a51c0a9b8a235d26fd12ab02/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f687972696f6f2f6879726e617469632d61757468656e74696361746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hyrioo/hyrnatic-authenticator)

**JWT based authentication for Laravel**
With refresh tokens and automatic reuse detection.

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

[](#installation)

You can install the package via composer:

```
composer require hyrioo/hyrnatic-authenticator
```

```
php artisan vendor:publish --provider="Hyrioo\HyrnaticAuthenticator\HyrnaticAuthenticatorServiceProvider"
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="hyrnatic-authenticator-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="hyrnatic-authenticator-config"
```

Usage
-----

[](#usage)

### Update user model

[](#update-user-model)

Add the `Hyrioo\HyrnaticAuthenticator\HasApiTokens` trait to your user model.

```
use Hyrioo\HyrnaticAuthenticator\Traits\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens;
}
```

### Configure auth guard

[](#configure-auth-guard)

Add `hyrnatic-authenticator` as the driver to your api guard.
*Example:*

```
'guards' => [
        'api' => [
            'driver' => 'hyrnatic-authenticator',
            'provider' => 'users',
        ],
    ],
```

### Issuing tokens

[](#issuing-tokens)

When issuing a new token, you will get a new token family, an access token and a refresh token. The token family can have a name, if you eg. want to show the active logins for the user. You can set individual expire for all three. It's also possible to set custom claims for both the access and refresh token.

```
$builder = auth('api')->create($user) // NewTokenBuilder
$builder->setName('Phone'); // Optional
$builder->setScopes(['photo.manage']); // Optional
$builder->setFamilyExpiresAt(now()->addYear()); // Optional
$builder->setAccessExpiresAt(now()->addMinutes(5)); // Optional
$builder->setRefreshExpiresAt(now()->addMonth()); // Optional

$token = $builder->getToken();
$token->accessToken;
$token->refreshToken;
```

Pass `null` to `setFamilyExpiresAt`, `setAccessExpiresAt` or `setRefreshExpiresAt` to explicitly disable expiration for that value.

### Refresh token

[](#refresh-token)

When refreshing the token, you can set a new expiry for both the access and refresh tokens. But scopes and custom claims will be the same.

```
$builder = auth('api')->refresh($request->refresh_token); // RefreshTokenBuilder
$builder->setAccessExpiresAt(now()->addMinutes(5)); // Optional
$builder->setRefreshExpiresAt(now()->addMonth()); // Optional

$token = $builder->refreshToken();
$token->accessToken;
$token->refreshToken;
```

### Revoke token

[](#revoke-token)

When revoking a token the entire token family will be revoked, and both refresh and access tokens will stop working.

```
auth('api')->logout();
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Hyrioo](https://github.com/msp@hyrioo.com)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance55

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5d4153d4518db05d62ae579e7f46a5d6b5aa5e418cd58d8e48e78b2b0e271afb?d=identicon)[hyrioo-msp](/maintainers/hyrioo-msp)

---

Top Contributors

[![hyrioo-msp](https://avatars.githubusercontent.com/u/111864009?v=4)](https://github.com/hyrioo-msp "hyrioo-msp (47 commits)")

### Embed Badge

![Health badge](/badges/hyrioo-hyrnatic-authenticator/health.svg)

```
[![Health](https://phpackages.com/badges/hyrioo-hyrnatic-authenticator/health.svg)](https://phpackages.com/packages/hyrioo-hyrnatic-authenticator)
```

PHPackages © 2026

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