PHPackages                             jscustom/laravel-sanctum-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. jscustom/laravel-sanctum-auth

ActiveLibrary

jscustom/laravel-sanctum-auth
=============================

Laravel package for user authentication.

v0.0.1-alpha(3y ago)04MITPHPPHP ^7.0|^8.0

Since Jun 18Pushed 3y agoCompare

[ Source](https://github.com/JSCustom/laravel-sanctum-auth)[ Packagist](https://packagist.org/packages/jscustom/laravel-sanctum-auth)[ RSS](/packages/jscustom-laravel-sanctum-auth/feed)WikiDiscussions master Synced 1mo ago

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

Laravel Sanctum Authenticator API
=================================

[](#laravel-sanctum-authenticator-api)

Laravel package for sanctum authenticator. Includes login, register, logout, change password and forgot password.

Table of Contents
-----------------

[](#table-of-contents)

[Getting Started](#getting-started)
[Prerequisite(s)](#prerequisites)
[Installation](#installation)
[How to Use](#how-to-use)
[Download Postman API](#download-postman-api)
[Sanctum Authenticator](#authenticator)
[Login API](#login-api)
[Register API](#register-api)
[Logout API](#logout-api)
[Change Password API](#change-password-api)
[Forgot Password (Send Request) API](#forgot-password-request-api)
[Forgot Password (Reset) API](#forgot-password-reset-api)
[Support](#support)

Getting Started
---------------

[](#getting-started)

Below are the steps in order to integrate sanctum authenticator API to your Laravel project.

Prerequisite(s)
---------------

[](#prerequisites)

### Laravel Sanctum

[](#laravel-sanctum)

Install Laravel Sanctum via Composer:

```
composer require laravel/sanctum
```

Uncomment ***\\Laravel\\Sanctum\\Http\\Middleware\\EnsureFrontendRequestsAreStateful::class*** located in the ***app/Http/Kernel.php*** file

```
'api' => [
  \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
  'throttle:api',
  \Illuminate\Routing\Middleware\SubstituteBindings::class,
]
```

Add the following lines of code to the ***$routeMiddleware*** variable in the ***app/Http/Kernel.php*** file

```
'abilities' => \Laravel\Sanctum\Http\Middleware\CheckAbilities::class,
'ability' => \Laravel\Sanctum\Http\Middleware\CheckForAnyAbility::class
```

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

[](#installation)

Install the package using composer:

```
composer require jscustom/laravel-sanctum-auth
```

Export the configuration file:

```
php artisan vendor:publish --provider="JSCustom\LaravelSanctumAuth\Providers\LaravelSanctumAuthServiceProvider" --tag="config"
```

Export the migration files:

```
php artisan vendor:publish --provider="JSCustom\LaravelSanctumAuth\Providers\LaravelSanctumAuthServiceProvider" --tag="migrations"
```

Do a quick migration:

```
php artisan migrate --path=/database/migrations/laravel-sanctum-auth
```

How To Use
----------

[](#how-to-use)

### Download Postman API

[](#download-postman-api)

Download the Postman API Collection [here](https://minhaskamal.github.io/DownGit/#/home?url=https://github.com/JSCustom/laravel-sanctum-auth/blob/master/src/assets/postman/Laravel_Sanctum_Auth.postman_collection.json).

### Sanctum Authenticator

[](#sanctum-authenticator)

**Features**

- Login
- Register
- Logout
- Change Password
- Forgot Password (Send Request)
- Forgot Password (Reset)

**Models**

```
JSCustom\LaravelSanctumAuth\Models\User
JSCustom\LaravelSanctumAuth\Models\UserProfile
JSCustom\LaravelSanctumAuth\Models\UserRole
JSCustom\LaravelSanctumAuth\Models\PasswordReset
```

### Login API

[](#login-api)

**Controller**

```
\JSCustom\LaravelSanctumAuth\Http\Controllers\Authenticator\AuthenticatorController
```

**URL**

```
{{url}}/api/auth/login
```

**Form Data**

```
{
  "username": "stevengrant",
  "email": "stevengrant@mail.com",
  "password": "yourpasswordhere",
}
```

**Method**

```
POST
```

**Headers**

```
{
  "Accept": "application/json"
}
```

**Response**

```
{
  "status": true,
  "message": "Welcome, Steven!",
  "payload": {
    "user": {
      "id": 1,
      "username": "stevengrant",
      "email": "stevengrant@mail.com",
      "status": 1,
      "role_id": 2,
      "email_verified_at": null,
      "created_at": "2022-06-14T23:27:07.000000Z",
      "updated_at": "2022-06-15T14:14:18.000000Z",
      "user_profile": {
        "id": 1,
        "user_id": 1,
        "first_name": "Steven",
        "last_name": "Grant",
        "created_at": "2022-06-14T23:24:42.000000Z",
        "updated_at": "2022-06-14T23:24:42.000000Z"
      },
      "user_role": {
        "id": 2,
        "role": "Regular User",
        "description": "Regular User description here",
        "created_at": "2022-06-14T23:24:42.000000Z",
        "updated_at": "2022-06-14T23:24:42.000000Z"
      }
    },
    "access_token": "4|SvOITBX0p79AujrZQFse75TJJgONp3kYuid7Q0uP"
  }
}
```

### Register API

[](#register-api)

**Controller**

```
\JSCustom\LaravelSanctumAuth\Http\Controllers\Authenticator\AuthenticatorController
```

**URL**

```
{{url}}/api/auth/register
```

**Form Data**

```
{
  "username": "markanthony",
  "email": "markanthony@mail.com",
  "status": 1,
  "role_id": 1,
  "first_name": "Mark",
  "last_name": "Anthony",
  "password": "yourpasswordhere"
}
```

**Method**

```
POST
```

**Headers**

```
{
  "Accept": "application/json"
}
```

**Response**

```
{
  "status": true,
  "message": "Register success.",
  "payload": {
    "user": {
      "username": "markanthony",
      "email": "markanthony@mail.com",
      "status": 1,
      "role_id": 1,
      "updated_at": "2022-06-15T14:33:56.000000Z",
      "created_at": "2022-06-15T14:33:56.000000Z",
      "id": 8,
      "password_unhashed": "yourpasswordhere",
      "user_role": {
        "id": 1,
        "role": "Regular User",
        "description": "Regular User description here",
        "created_at": "2022-06-14T23:24:42.000000Z",
        "updated_at": "2022-06-14T23:24:42.000000Z"
      },
      "user_profile": {
        "id": 4,
        "user_id": 8,
        "first_name": "Mark",
        "last_name": "Anthony",
        "created_at": "2022-06-15T14:33:56.000000Z",
        "updated_at": "2022-06-15T14:33:56.000000Z"
      }
    }
  }
}
```

### Logout API

[](#logout-api)

**Controller**

```
\JSCustom\LaravelSanctumAuth\Http\Controllers\Authenticator\AuthenticatorController
```

**URL**

```
{{url}}/api/auth/logout
```

**Method**

```
POST
```

**Headers**

```
{
  "Authorization": "Bearer ...",
  "Accept": "application/json"
}
```

**Response**

```
{
  "status": true,
  "message": "Logout successful."
}
```

### Change Password API

[](#change-password-api)

**Controller**

```
\JSCustom\LaravelSanctumAuth\Http\Controllers\Authenticator\AuthenticatorController
```

**URL**

```
{{url}}/api/auth/change-password
```

**Parameters**

```
{
  "current_password": "yourcurrentpassword",
  "new_password": "yournewpassword",
  "new_password_confirmation": "yournewpassword"
}
```

**Method**

```
POST
```

**Headers**

```
{
  "Authorization": "Bearer ...",
  "Accept": "application/json"
}
```

**Response**

```
{
  "status": true,
  "message": "Password updated successfully."
}
```

### Forgot Password (Send Request) API

[](#forgot-password-send-request-api)

**Controller**

```
\JSCustom\LaravelSanctumAuth\Http\Controllers\Authenticator\AuthenticatorController
```

**URL**

```
{{url}}/api/auth/forgot-password
```

**Parameters**

```
{
  "email": "markanthony@mail.com"
}
```

**Method**

```
POST
```

**Headers**

```
{
  "Accept": "application/json"
}
```

**Response**

```
{
  "status": true,
  "message": "A forgot password request was sent to your email.",
  "payload": {
    "reset_password_token": "$2y$10$ELeKX3zUOBMQJSmuFdaAwOf7id7NNuxXwydfwL/.sIUdEZ35gwi7y"
  }
}
```

### Forgot Password (Reset) API

[](#forgot-password-reset-api)

**Controller**

```
\JSCustom\LaravelSanctumAuth\Http\Controllers\Authenticator\AuthenticatorController
```

**URL**

```
{{url}}/api/auth/reset-password
```

**Parameters**

```
{
  "new_password": "yournewpassword",
  "new_password_confirmation": "yournewpassword",
  "reset_password_token": "$2y$10$IqsuRxB5ugH/aui3PCNzPeWBBKilUc3Cgy1K/F48NkgJ/O4kbO0bC"
}
```

**Method**

```
POST
```

**Headers**

```
{
  "Accept": "application/json"
}
```

**Response**

```
{
  "status": true,
  "message": "Password reset successfully."
}
```

### Support

[](#support)

For support, email .

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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

Unknown

Total

1

Last Release

1424d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b559eadc57e518a855212ca3c95827b9ed955c09b143490c82ba11d3e81e63e8?d=identicon)[jeddsaliba](/maintainers/jeddsaliba)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jscustom-laravel-sanctum-auth/health.svg)

```
[![Health](https://phpackages.com/badges/jscustom-laravel-sanctum-auth/health.svg)](https://phpackages.com/packages/jscustom-laravel-sanctum-auth)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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