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

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

equidna/swift-auth
==================

Bottled authentication for Laravel projects

4.0.0(2mo ago)043MITPHPPHP ^8.2 || ^8.3 || ^8.4CI failing

Since Nov 17Pushed 2mo agoCompare

[ Source](https://github.com/EquidnaMX/swift_auth)[ Packagist](https://packagist.org/packages/equidna/swift-auth)[ RSS](/packages/equidna-swift-auth/feed)WikiDiscussions main Synced today

READMEChangelog (8)Dependencies (26)Versions (8)Used By (0)

SwiftAuth
=========

[](#swiftauth)

**Bottled authentication for Laravel projects.**

SwiftAuth is a production-ready authentication package for **Laravel 11 and 12** that provides a complete, drop-in identity management layer. It ships session-based authentication, multi-factor authentication (OTP and WebAuthn / Passkeys), role-based access control, concurrent session management with configurable limits and eviction strategies, account lockout, password reset, email verification, remember-me tokens, API token issuance (Sanctum-compatible), and multi-tenancy via **BeeHive** — all configurable through a single published config file and accessible through a clean Facade.

**Package type:** Composer library (not a standalone application). **Namespace:** `Equidna\SwiftAuth\`. **Service provider:** `Equidna\SwiftAuth\Providers\SwiftAuthServiceProvider` (auto-discovered via `composer.json`).

---

Documentation Index
-------------------

[](#documentation-index)

- [Deployment Instructions](doc/deployment-instructions.md)
- [Securing Routes](doc/securing-routes.md) — Session &amp; API Token Authentication
- [API Documentation](doc/api-documentation.md)
- [Routes Documentation](doc/routes-documentation.md)
- [Artisan Commands](doc/artisan-commands.md)
- [Tests Documentation](doc/tests-documentation.md)
- [Architecture Diagrams](doc/architecture-diagrams.md)
- [Monitoring](doc/monitoring.md)
- [Business Logic &amp; Core Processes](doc/business-logic-and-core-processes.md)
- [Open Questions &amp; Assumptions](doc/open-questions-and-assumptions.md)

> This documentation and the codebase follow the project's **Coding Standards Guide** and **PHPDoc Style Guide**.

---

Tech Stack &amp; Requirements
-----------------------------

[](#tech-stack--requirements)

PropertyValueTypeLaravel Package (Composer library)PHP^8.2, ^8.3, ^8.4Laravel11.x / 12.xFrontendBlade, Inertia + TypeScript, or Inertia + JavaScriptDatabaseAny Laravel-supported driver (SQLite, MySQL, PostgreSQL)CacheAny Laravel cache driverQueueNot required (operations are synchronous by default)**Key dependencies:**

- `equidna/bee-hive ^2.0` — Multi-tenancy (BelongsToTenant trait, TenantScope, TenantContext)
- `equidna/bird-flock ^1.2` — Notification and email dispatch bus
- `equidna/toolkit` — Shared helpers: ResponseHelper, exceptions
- `laragear/webauthn ^5.0` — WebAuthn / Passkey support
- `laravel/sanctum ^4.3` — API token authentication
- `inertiajs/inertia-laravel ^3.0` — Inertia.js SPA adapter

---

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

[](#quick-start)

1. **Install the package:**

    ```
    composer require equidna/swift-auth
    ```
2. **Run the install command** (publishes config, runs migrations):

    ```
    php artisan swift-auth:install
    ```
3. **Configure environment variables** in `.env`:

    ```
    SWIFT_AUTH_FRONTEND=typescript          # blade | typescript | javascript
    SWIFT_AUTH_SUCCESS_URL=/dashboard
    SWIFT_AUTH_ALLOW_REGISTRATION=false
    SWIFT_AUTH_TABLE_PREFIX=swift-auth_
    SWIFT_AUTH_ROUTE_PREFIX=swift-auth
    ```
4. **Run migrations** (if not already run by the installer):

    ```
    php artisan migrate
    ```
5. **Create an initial admin user:**

    ```
    php artisan swift-auth:create-admin
    ```
6. **Start the application:**

    ```
    php artisan serve
    ```

    Navigate to `/{route-prefix}/login` (default: `/swift-auth/login`).

---

Using the Facade
----------------

[](#using-the-facade)

```
use Equidna\SwiftAuth\Support\Facades\SwiftAuth;

// Check authentication
if (SwiftAuth::check()) {
    $user = SwiftAuth::user();
    $userId = SwiftAuth::id();
}

// Permission checks
SwiftAuth::canPerformAction('sw-admin');
SwiftAuth::hasRole('administrator');

// Session management
$sessions = SwiftAuth::sessionsForUser($userId);
SwiftAuth::revokeSession($userId, $sessionId);

// Manual login/logout
SwiftAuth::login($user, $ip, $userAgent, $deviceName, remember: true);
SwiftAuth::logout();
```

---

Protecting Routes
-----------------

[](#protecting-routes)

**Session-based (web) authentication:**

```
Route::middleware('SwiftAuth.RequireAuthentication')->group(function () {
    Route::get('/dashboard', [DashboardController::class, 'index']);
});

// With action-based authorization
Route::middleware(['SwiftAuth.RequireAuthentication', 'SwiftAuth.CanPerformAction:sw-admin'])
    ->group(function () {
        Route::get('/admin', [AdminController::class, 'index']);
    });
```

**API token authentication:**

```
Route::middleware('SwiftAuth.AuthenticateWithToken')->group(function () {
    Route::get('/api/profile', [ProfileController::class, 'show']);
});

// With token ability check
Route::middleware(['SwiftAuth.AuthenticateWithToken', 'SwiftAuth.CheckTokenAbilities:posts:write'])
    ->group(function () {
        Route::post('/api/posts', [PostController::class, 'store']);
    });
```

For full reference, see [Securing Routes](doc/securing-routes.md).

---

Localization
------------

[](#localization)

SwiftAuth ships translations for **English (en)** and **Spanish (es)**. Locale is persisted in the user session and can be switched at runtime via the `POST /{prefix}/locale/{locale}` endpoint.

**In PHP / Blade:**

```
__('swift-auth::auth.login_title')
```

**In TypeScript / JavaScript:**

```
import { __ } from "../../../lang/translations";
{__("auth.login_title")}
```

For comprehensive localization documentation, see [Localization Guide](doc/localization.md).

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance86

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~32 days

Recently: every ~40 days

Total

6

Last Release

67d ago

Major Versions

1.0.2 → 2.0.02025-12-15

2.0.0 → 3.0.02025-12-31

3.0.0 → 4.0.02026-04-27

PHP version history (2 changes)1.0.0PHP ^8.2

2.0.0PHP ^8.2 || ^8.3 || ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/984800?v=4)[gruelas](/maintainers/gruelas)[@gruelas](https://github.com/gruelas)

---

Top Contributors

[![gruelasjr](https://avatars.githubusercontent.com/u/40619710?v=4)](https://github.com/gruelasjr "gruelasjr (45 commits)")[![raulcruzTU](https://avatars.githubusercontent.com/u/142824075?v=4)](https://github.com/raulcruzTU "raulcruzTU (42 commits)")[![memoola49](https://avatars.githubusercontent.com/u/55213964?v=4)](https://github.com/memoola49 "memoola49 (15 commits)")[![GerardoResendiz](https://avatars.githubusercontent.com/u/92111855?v=4)](https://github.com/GerardoResendiz "GerardoResendiz (14 commits)")[![vicario00](https://avatars.githubusercontent.com/u/101902535?v=4)](https://github.com/vicario00 "vicario00 (9 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (6 commits)")[![karlyoz](https://avatars.githubusercontent.com/u/54610989?v=4)](https://github.com/karlyoz "karlyoz (6 commits)")[![LauraRivera1607](https://avatars.githubusercontent.com/u/147354444?v=4)](https://github.com/LauraRivera1607 "LauraRivera1607 (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/equidna-swift-auth/health.svg)

```
[![Health](https://phpackages.com/badges/equidna-swift-auth/health.svg)](https://phpackages.com/packages/equidna-swift-auth)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6783.6k6](/packages/hasinhayder-tyro)

PHPackages © 2026

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