PHPackages                             hans-thomas/sphinx - 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. hans-thomas/sphinx

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

hans-thomas/sphinx
==================

JSON web token driver for laravel

v2.2.1(9mo ago)52.7k[1 issues](https://github.com/hans-thomas/sphinx/issues)MITPHPPHP ^8.1CI passing

Since Jun 28Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/hans-thomas/sphinx)[ Packagist](https://packagist.org/packages/hans-thomas/sphinx)[ RSS](/packages/hans-thomas-sphinx/feed)WikiDiscussions 2.x Synced 1w ago

READMEChangelog (9)Dependencies (5)Versions (12)Used By (0)

Sphinx
======

[](#sphinx)

[![sphinx Logo](assets/sphinx-banner.png)](assets/sphinx-banner.png)

[![codecov](https://camo.githubusercontent.com/177c8a1ad0391a481b6fcf00511574a75584484ce6218d4f9d7a6d6fdca81217/68747470733a2f2f636f6465636f762e696f2f67682f68616e732d74686f6d61732f737068696e782f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d5831443649304a4c535a)](https://codecov.io/gh/hans-thomas/sphinx)[![GitHub Workflow Status](https://camo.githubusercontent.com/e8eb07d5f02d38475b454d7ea9449dfa66d146badb3b452fb6536f2d1ba557ff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616e732d74686f6d61732f737068696e782f7068702e796d6c)](https://camo.githubusercontent.com/e8eb07d5f02d38475b454d7ea9449dfa66d146badb3b452fb6536f2d1ba557ff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616e732d74686f6d61732f737068696e782f7068702e796d6c)[![GitHub top language](https://camo.githubusercontent.com/9e69af1863738768a0f79ee32cb675ddd69eb842aef29af9ae6427fc629d04f0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f68616e732d74686f6d61732f737068696e78)](https://camo.githubusercontent.com/9e69af1863738768a0f79ee32cb675ddd69eb842aef29af9ae6427fc629d04f0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f68616e732d74686f6d61732f737068696e78)[![GitHub release (latest by date)](https://camo.githubusercontent.com/1688fcc5a3c42b5982b18b5c642e9d857015e415d913980935ae13a38effd253/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f68616e732d74686f6d61732f737068696e78)](https://camo.githubusercontent.com/1688fcc5a3c42b5982b18b5c642e9d857015e415d913980935ae13a38effd253/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f68616e732d74686f6d61732f737068696e78)[![StyleCi](https://camo.githubusercontent.com/1c2686517b1ce42f09dd1b2f1596e5bd3a20ed39bd174471a7c0a1ea5f8ec7d7/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3436343439363137332f736869656c643f7374796c653d706c6173746963)](https://camo.githubusercontent.com/1c2686517b1ce42f09dd1b2f1596e5bd3a20ed39bd174471a7c0a1ea5f8ec7d7/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3436343439363137332f736869656c643f7374796c653d706c6173746963)

Sphinx is a feature reach Jwt-based authentication system that make zero queries to database during authorization.

- Customizable
- Integration support with [Horus](https://github.com/hans-thomas/horus)
- Based on Jwt
- Two layers of encryption
- Refresh token support
- Logged-in users in one account limitation

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

[](#installation)

Install the package via composer.

```
composer require hans-thomas/sphinx

```

Then, publish config file.

```
php artisan vendor:publish --tag sphinx-config

```

Setting up
----------

[](#setting-up)

### Model

[](#model)

First, use `Hans\Sphinx\Traits\SphinxTrait` trait on your model and then implement the abstract methods. Next, inside your model, make sure to call the `hooks` method in your `booted` method.

```
use SphinxTrait, SphinxTrait {
    SphinxTrait::hooks as private sphinxHooks;
}

protected static function booted() {
    self::sphinxHooks();
}

```

### Auth configuration

[](#auth-configuration)

First of all, define the provider.

```
'providers' => [
    // ...
    'sphinxUsers' => [
        'driver' => 'sphinx',
        'model'  => App\Models\User::class,
    ],
    // ...
],

```

Then, add your guard.

```
'guards' => [
    // ...
    'jwt' => [
        'driver'   => 'sphinxJwt',
        'provider' => 'sphinxUsers',
    ],
    // ...
],

```

And finally, you can set the `jwt` guard as default.

```
'defaults' => [
    // ...
    'guard'     => 'jwt',
    // ...
],

```

All sets. enjoy!

Read more about Sphinx in [documentation](https://docs-sphinx.vercel.app/) website.

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

[](#contributing)

1. Fork it!
2. Create your feature branch: git checkout -b my-new-feature
3. Commit your changes: git commit -am 'Add some feature'
4. Push to the branch: git push origin my-new-feature
5. Submit a pull request ❤️

Support
-------

[](#support)

- [Documentation](https://docs-sphinx.vercel.app/)
- [Report bugs](https://github.com/hans-thomas/sphinx)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance53

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.6% 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 ~70 days

Recently: every ~39 days

Total

12

Last Release

284d ago

Major Versions

1.x-dev → v2.0.02025-02-08

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39920372?v=4)[Mohammad Mortazavi](/maintainers/hans-thomas)[@hans-thomas](https://github.com/hans-thomas)

---

Top Contributors

[![hans-thomas](https://avatars.githubusercontent.com/u/39920372?v=4)](https://github.com/hans-thomas "hans-thomas (151 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (12 commits)")

---

Tags

jwtjwt-authjwt-authenticationjwt-authorizationjwt-tokenlaravellaravel-packagejwtlaravellaravel-packagejwt-tokenjwt-authenticationjwt-authorization

### Embed Badge

![Health badge](/badges/hans-thomas-sphinx/health.svg)

```
[![Health](https://phpackages.com/badges/hans-thomas-sphinx/health.svg)](https://phpackages.com/packages/hans-thomas-sphinx)
```

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)

PHPackages © 2026

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