New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

equidna/domain-token-auth

Secure domain-based token authentication package for Laravel
1,765

Larablocks Analysis

equidna/domain-token-auth works with Laravel 12 and 13 (latest release 2.3.0, Aug 26, 2026).

Promising: maintained and up to date, meets 2 of 4 checks; not yet widely used.

  • Works with Laravel 13, the current version
  • Released in the last 12 months (Aug 26, 2026)
  • 297 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Actively maintained
  • Last stable release: Aug 26, 2026.
  • 5 releases in the last 12 months.
  • First released: Apr 20, 2026.
  • Monthly downloads: 297.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 29, 2026.

Install
composer require equidna/domain-token-auth
Latest Version:2.3.0
PHP:^8.2
Laravel:12 · 13
License:MIT
Last Updated:Aug 26, 2026
Links: GitHub  ·  Packagist
Maintainer: gruelas

README

This documentation follows the coding conventions reflected throughout the codebase.


Project Overview

equidna/domain-token-auth is a Laravel package that provides secure, domain-scoped opaque token authentication. It issues cryptographically random tokens tied to a functional domain, a polymorphic owner model, a set of roles and fine-grained actions, optional custom data payload, and an optional validity window. Tokens are stored only as SHA-256 hashes; the plain-text value is shown exactly once at issuance time.

Who it is for:

  • Laravel application developers who need API token authentication without depending on Laravel Sanctum or Passport.
  • Multi-tenant SaaS platforms that must ensure a token issued for one tenant cannot be used in another tenant's context (via optional equidna/bee-hive integration).
  • Integrators building machine-to-machine token pipelines with per-domain authorization rules.

Main use cases:

  • Issuing short-lived or long-lived tokens for human users, application clients, services, or partner integrations, each in its own named domain.
  • Protecting routes with per-domain middleware (domain-token:{domain}).
  • Enforcing fine-grained action authorization with wildcard support (users.*, *).
  • Attaching and consuming domain-specific metadata through token data after authentication.
  • Revoking tokens immediately without modifying the consuming request flow.

Project Type & Tech Summary

Property Value
Project type Laravel package (library)
Package name equidna/domain-token-auth
PHP version ^8.2
Laravel version ^12.0|^13.0 (via illuminate/* components)
Symfony version HttpFoundation ^7.2|^8.0
Primary database Relies on the host application's configured database
Cache Not used internally
Queue Not used internally
Key external service equidna/bee-hive (optional) - multi-tenant context propagation

Quick Start

Laravel 12 runs on PHP 8.2+ with Symfony 7. Laravel 13 requires PHP 8.3+ and supports Symfony 7.4 or 8; Symfony 8 itself requires PHP 8.4+.

  1. Install via Composer:

    composer require equidna/domain-token-auth
    
  2. Publish the configuration file:

    php artisan vendor:publish --tag=domain-token-auth:config
    
  3. Publish and run migrations:

    php artisan vendor:publish --tag=domain-token-auth:migrations
    php artisan migrate
    
  4. Implement TokenOwner on your owner model and add the HasDomainTokens trait:

    use Equidna\DomainTokenAuth\Concerns\HasDomainTokens;
    use Equidna\DomainTokenAuth\Contracts\TokenOwner;
    use Illuminate\Database\Eloquent\Model;
    
    class User extends Model implements TokenOwner
    {
        use HasDomainTokens;
    }
    
  5. Configure your domains in config/domain-token-auth.php.

  6. Protect routes with the domain-token middleware:

    Route::middleware('domain-token:user')->group(function () {
        Route::get('/profile', ProfileController::class);
    });
    
  7. Issue tokens via the facade or Artisan command:

    use Equidna\DomainTokenAuth\Facades\DomainToken;
    
    $issued = DomainToken::issue(
       domain: 'user',
       owner: $user,
       roles: ['admin'],
       data: ['client' => 'mobile', 'region' => 'mx']
    );
    $plainToken = $issued->plainTextToken; // show once
    
  8. Consume authenticated token data in protected routes:

    Route::middleware('domain-token:user')->get('/me', function () {
       return [
          'client' => DomainToken::data('client'),
          'all_data' => DomainToken::data(),
       ];
    });
    

For full details, see Deployment Instructions.


Documentation Index


License

MIT - see LICENSE.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released PHP Laravel License
2.3.0 ^8.2 ^12.0|^13.0 MIT
2.2.0 ^8.2 ^12.0 MIT
2.1.0 ^8.2 ^12.0 MIT
2.0.0 ^8.2 ^12.0 MIT
1.0.0 ^8.2 ^12.0 MIT