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

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

vancil/flint-auth
=================

UI scaffold for Flint — session-based auth with Bootstrap, Vue, and React presets

v1.0.1(1mo ago)00MITPHPPHP &gt;=8.1CI passing

Since May 31Pushed 1mo agoCompare

[ Source](https://github.com/Vancil/flint-auth)[ Packagist](https://packagist.org/packages/vancil/flint-auth)[ RSS](/packages/vancil-flint-auth/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (2)Versions (9)Used By (0)

flint-auth
==========

[](#flint-auth)

 [![Tests](https://camo.githubusercontent.com/3e0107b7af60a1fc1f1d7dfab5c54f29f903908198974f67c99e12e45e6c9f57/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f56616e63696c2f666c696e742d617574682f63692e796d6c3f6c6162656c3d7465737473)](https://github.com/Vancil/flint-auth/actions/workflows/ci.yml) [![Total Downloads](https://camo.githubusercontent.com/6fe19eacf49ceb9da8465b6bba788b7fa46781cc718e2a9a16c344e29d761959/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f76616e63696c2f666c696e742d61757468)](https://packagist.org/packages/vancil/flint-auth) [![Latest Version on Packagist](https://camo.githubusercontent.com/fa551403104856649775b2637097c883a264f17a40cfc6bfb4d22d6e7de888de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76616e63696c2f666c696e742d61757468)](https://packagist.org/packages/vancil/flint-auth) [![License](https://camo.githubusercontent.com/b8cadaa967891081f8f165695470689986c028821dd8a040132f6e661795dc0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c7565)](https://github.com/Vancil/flint-auth/blob/master/LICENSE)

UI scaffold package for the [Flint framework](https://github.com/Vancil/flint). Scaffolds session-based authentication with your choice of Bootstrap (server-rendered), Vue, or React frontend preset.

> **v2.0 — breaking change.** The previous JWT API auth package has been replaced entirely. See the [migration guide](#migrating-from-v1) if you are upgrading.

---

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

[](#installation)

```
composer require vancil/flint-auth
```

Register the package in `config/app.php`:

```
'packages' => [
    \Vancil\FlintAuth\FlintAuth::class,
],
```

---

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

[](#quick-start)

Pick a frontend preset and add `--auth` to scaffold all authentication pages:

```
# Bootstrap 5 — server-rendered Spark templates
php flint ui bootstrap --auth

# Vue 3 + Vite — SPA with JSON API backend
php flint ui vue --auth

# React 18 + Vite — SPA with JSON API backend
php flint ui react --auth
```

Then run your migrations and start the server:

```
php flint migrate
php -S localhost:8000 -t public
```

Visit `http://localhost:8000/register` to get started.

For Vue/React presets, install JS dependencies and start the dev server:

```
npm install && npm run dev
```

---

What Gets Scaffolded
--------------------

[](#what-gets-scaffolded)

Running `php flint ui  --auth` publishes the following into your application:

**Migrations** (`database/migrations/`)

- `create_users_table` — id, name, email, password, remember\_token, email\_verified\_at, timestamps
- `create_password_reset_tokens_table` — email, token, created\_at
- `create_email_verifications_table` — email, token, created\_at

**Models** (`app/Models/`)

- `User.php`
- `PasswordResetToken.php`
- `EmailVerification.php`

**Auth pages**

RouteDescription`GET /register`Registration form`POST /register`Create account + send verification email`GET /login`Login form`POST /login`Authenticate + start session`POST /logout`End session`GET /forgot-password`Request a password reset link`POST /forgot-password`Send reset email`GET /reset-password/{token}`Password reset form`POST /reset-password`Apply new password`GET /email/verify`"Please verify your email" notice`GET /email/verify/{token}`Verify email address`POST /email/verify/resend`Resend verification email`GET /dashboard`Authenticated dashboard (protected by `auth` middleware)**Config** — `config/auth.php` and session/mail defaults written to `.env`.

---

Presets
-------

[](#presets)

### Bootstrap

[](#bootstrap)

Server-rendered HTML using Flint's **Spark** template engine (`.spark.php` files). Bootstrap 5 is loaded from CDN — no build step required.

Controllers are published to `app/Controllers/Auth/` and use `Response::view()`, `Response::back()`, and session flash for form repopulation.

### Vue

[](#vue)

Vite + Vue 3 SPA. Auth pages are Vue single-file components that call the JSON API endpoints (`/api/auth/*`) using `fetch` with `credentials: 'include'` so the session cookie is sent automatically.

```
resources/js/
  main.js
  router/index.js
  views/LoginView.vue
  views/RegisterView.vue
  views/ForgotPasswordView.vue
  views/ResetPasswordView.vue
  views/DashboardView.vue

```

### React

[](#react)

Vite + React 18 SPA. Same JSON API approach as the Vue preset.

```
resources/js/
  main.jsx
  router/AppRouter.jsx
  pages/LoginPage.jsx
  pages/RegisterPage.jsx
  pages/ForgotPasswordPage.jsx
  pages/ResetPasswordPage.jsx
  pages/DashboardPage.jsx

```

---

Auth in Controllers
-------------------

[](#auth-in-controllers)

The `Flint\Auth\Auth` class is available via constructor injection anywhere in your application:

```
use Flint\Auth\Auth;
use Flint\Request;
use Flint\Response;

class DashboardController
{
    public function __construct(private readonly Auth $auth) {}

    public function index(Request $request): Response
    {
        $user = $this->auth->user();

        return Response::view('dashboard', ['user' => $user]);
    }
}
```

MethodDescription`$auth->user()`The authenticated user object, or `null``$auth->check()``true` if a user is logged in`$auth->id()`The authenticated user's ID`$auth->guest()``true` if no user is logged in`$auth->login($user, $remember)`Log a user in; optionally set a 30-day remember-me cookie`$auth->logout()`End the session and clear remember-me cookie---

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

[](#protecting-routes)

Use the built-in `auth` middleware alias (registered by Flint core) to restrict routes to authenticated users:

```
$router->group(['middleware' => ['auth']], function ($router) {
    $router->get('/dashboard',  [DashboardController::class, 'index']);
    $router->get('/settings',   [SettingsController::class, 'show']);
    $router->put('/settings',   [SettingsController::class, 'update']);
});
```

Unauthenticated visitors are automatically redirected to `/login`.

---

Mail (Password Reset &amp; Email Verification)
----------------------------------------------

[](#mail-password-reset--email-verification)

Mail is handled by Flint's built-in mailer. Set your driver in `.env`:

```
MAIL_DRIVER=log           # default — writes to storage/logs/mail.log
MAIL_DRIVER=smtp          # sends real email
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=your-username
MAIL_PASSWORD=your-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=hello@example.com
MAIL_FROM_NAME="My App"
```

Email templates are published to `resources/views/emails/` and are plain `.spark.php` files you can customise freely.

---

Database
--------

[](#database)

Three tables are created by the scaffolded migrations:

TablePurpose`users`Registered users with optional email verification and remember-me support`password_reset_tokens`Single-use tokens for password reset (expire after 1 hour)`email_verifications`Single-use tokens for email address verification---

Migrating from v1
-----------------

[](#migrating-from-v1)

v1 used JWT Bearer tokens for API authentication. v2 uses server-side sessions.

**Removed:** `JwtMiddleware`, `RefreshMiddleware`, `RefreshToken` model, `auth:install` command, `firebase/php-jwt` dependency, `JWT_SECRET`/`JWT_ALGORITHM` config.

**Replaced with:** Flint core `Session`, `Csrf`, and `Auth` classes — no extra package needed for the auth primitives themselves.

If you need to keep JWT for a pure API application, tag your v1 install and do not upgrade.

---

License
-------

[](#license)

MIT — [Vancil](https://github.com/Vancil)

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance89

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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 ~0 days

Total

2

Last Release

55d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/57faf02cb728789f5bb1242a73090ac1e9040ca9c10baf655e3a7e72d555d9ad?d=identicon)[SimpleVerify](/maintainers/SimpleVerify)

---

Top Contributors

[![danrovito](https://avatars.githubusercontent.com/u/8322674?v=4)](https://github.com/danrovito "danrovito (26 commits)")[![michael-mcmullen](https://avatars.githubusercontent.com/u/811123?v=4)](https://github.com/michael-mcmullen "michael-mcmullen (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vancil-flint-auth/health.svg)

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

###  Alternatives

[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)[firemultimedia/mautic-multi-captcha-bundle

This plugin brings Google's reCAPTCHA, hCaptcha, and Cloudflare Turnstile integration to mautic.

141.3k](/packages/firemultimedia-mautic-multi-captcha-bundle)

PHPackages © 2026

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