innonazarene/sanctum-auth-kit

One-command Laravel Sanctum auth boilerplate (register, login, logout, me, change password, forgot/reset password, email verification) with an AuthController, routes, and Scramble API docs installed automatically.

Maintainers

Package info

github.com/innonazarene/sanctum-auth-kit

pkg:composer/innonazarene/sanctum-auth-kit

Transparency log

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-07-21 03:50 UTC

This package is auto-updated.

Last update: 2026-07-21 03:51:00 UTC


README

One-command Laravel Sanctum auth boilerplate. Installs a full token-based AuthController (register, login, logout, me, change password, forgot/reset password, email verification), wires up the routes, and installs Scramble so your API docs are live at /docs/api — all from a single artisan command.

Requirements

  • PHP ^8.1
  • Laravel ^10.0 | ^11.0 | ^12.0 | ^13.0

Installation

composer require innonazarene/sanctum-auth-kit
php artisan sanctum-auth:install

That single install command will:

  1. Publish Laravel Sanctum's config and migration.
  2. Add the HasApiTokens trait to App\Models\User (only if it's not already there).
  3. Publish App\Http\Controllers\Api\AuthController.
  4. Publish the auth form requests to App\Http\Requests\Auth:
    • LoginRequest
    • RegisterRequest
    • ChangePasswordRequest
    • ForgotPasswordRequest
    • ResetPasswordRequest
  5. Publish routes/auth.php and require it from routes/api.php.
  6. Publish Scramble's config so /docs/api serves generated OpenAPI docs for the new endpoints.

Run php artisan migrate afterwards to create the personal_access_tokens table.

Pass --force to overwrite files that already exist:

php artisan sanctum-auth:install --force

Generated endpoints

Routes are published to routes/auth.php and required from routes/api.php, so Laravel's default api route-group prefix applies — every endpoint below is served under /api.

Method URI Auth required Description
POST /api/auth/register Register + issue a token
POST /api/auth/login Login + issue a token
POST /api/auth/forgot-password Send a password reset link
POST /api/auth/reset-password Reset password via token
GET /api/auth/verify-email/{id}/{hash} signed Verify email address
POST /api/auth/logout Revoke the current token
GET /api/auth/me Get the authenticated user
POST /api/auth/change-password Change password
POST /api/auth/email/verification-notification Resend verification email

If routes/api.php doesn't exist yet (a plain Laravel 11+ skeleton doesn't ship one), the installer creates it and registers it in bootstrap/app.php automatically.

All published files are plain Laravel code — edit them freely after installation, this package does not hook into them afterwards.

License

MIT