PHPackages                             blaspsoft/token-forge - 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. blaspsoft/token-forge

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

blaspsoft/token-forge
=====================

Token Forge brings Laravel Jetstream token management over to Laravel Breeze

v0.2.0(1y ago)357003MITPHPPHP ^8.0

Since Nov 14Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Blaspsoft/token-forge)[ Packagist](https://packagist.org/packages/blaspsoft/token-forge)[ Docs](https://github.com/blaspsoft/token-forge)[ RSS](/packages/blaspsoft-token-forge/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

 [![Blasp Icon](./assets/icon.png)](./assets/icon.png)

 [![Total Downloads](https://camo.githubusercontent.com/cad97c41e032e3a6c463405de9d3a6304f265b1ea2a29950ef97fd3166106613/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626c617370736f66742f746f6b656e2d666f726765)](https://packagist.org/packages/blaspsoft/token-forge) [![Latest Version](https://camo.githubusercontent.com/eaec4f8cb60ca0ff7486247e5472947c20806a93e70883144cf268e736ab1531/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626c617370736f66742f746f6b656e2d666f726765)](https://packagist.org/packages/blaspsoft/token-forge) [![License](https://camo.githubusercontent.com/caa52840246becaa64f1ed4081529649aabad8bd59cffb6a09eaef77fea7a17c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626c617370736f66742f746f6b656e2d666f726765)](https://packagist.org/packages/blaspsoft/token-forge)

Token Forge - API Token Management for Laravel Breeze
=====================================================

[](#token-forge---api-token-management-for-laravel-breeze)

`blaspsoft/token-forge` is a Laravel package that adds robust, customizable API token management to your application, inspired by Laravel Jetstream. Token Forge allows you to create, manage, and monitor API tokens with ease, providing secure access control for your API.

**Note:** This package supports both the **Blade** and **Inertia Vue** Laravel Breeze stacks.

Features
--------

[](#features)

- Generate and manage API tokens for users
- Define token permissions for precise access control
- Monitor token activity and revoke tokens when necessary
- Seamlessly integrates with Laravel’s authentication and session management
- Uses a contract (`TokenForgeController` interface) for flexibility and stack-specific implementation

Requirements
------------

[](#requirements)

This package requires the following dependencies:

- **Laravel Breeze**: Must use the Blade or Inertia Vue stack for front-end support.
- **Laravel Sanctum**: Provides token-based authentication for API tokens.

Install Laravel Breeze with the relevant stack:

```
# For Blade stack:
composer require laravel/breeze --dev
php artisan breeze:install blade

# For Vue-Inertia stack:
composer require laravel/breeze --dev
php artisan breeze:install vue
```

Install Laravel Sanctum:

```
composer require laravel/sanctum
php artisan install:api
php artisan migrate
```

Then install the front-end dependencies:

```
npm install
npm run dev
```

---

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

[](#installation)

Install the package via Composer:

```
composer require blaspsoft/token-forge
```

After installing the package, publish the configuration file:

```
php artisan vendor:publish --tag=token-forge-config --force
```

This command will publish a configuration file at `config/token-forge.php`, where you can customize Token Forge settings.

---

Setup Instructions
------------------

[](#setup-instructions)

### 1. Install the Stack

[](#1-install-the-stack)

Depending on your Laravel Breeze stack, run the appropriate command to install Token Forge:

- For **Blade** stack:

    ```
    php artisan token-forge:install blade
    ```
- For **Vue-Inertia** stack:

    ```
    php artisan token-forge:install vue
    ```

This command will:

- Copy the appropriate controller (`BladeTokenController` or `VueTokenController`) to your `app/Http/Controllers` directory.
- Automatically bind the `TokenForgeController` interface to the correct implementation.

---

### 2. Sanctum Setup

[](#2-sanctum-setup)

Ensure that Laravel Sanctum is properly configured. Make sure the `HasApiTokens` trait is added to your `User` model:

```
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;
}
```

Additionally, ensure that Sanctum's setup command is run to install its configuration and migrations:

```
php artisan install:api
php artisan migrate
```

---

### 3. Middleware Configuration (Inertia Vue Only)

[](#3-middleware-configuration-inertia-vue-only)

To ensure that Token Forge integrates smoothly with your Inertia responses, modify your `HandleInertiaRequest.php` middleware file as follows:

Add the following block to the `share` method in `app/Http/Middleware/HandleInertiaRequest.php`:

```
public function share(Request $request): array
{
    return [
        ...parent::share($request),
        'auth' => [
            'user' => $request->user(),
        ],
        'flash' => [
            'tokenForge' => [
                'token' => fn () => session()->get('token'),
            ],
        ],
    ];
}
```

This setup enables Token Forge to flash token information to your Inertia responses, allowing you to use the token in your Vue components.

---

### 4. API Token Management Routes

[](#4-api-token-management-routes)

The routes provided by Token Forge implement the `TokenForgeController` interface, allowing flexibility for different stacks. The interface is automatically resolved to the correct implementation (Blade or Vue) based on the installation.

Here are the available routes:

MethodURIInterface MethodDescriptionGET`/api-tokens``index`Display the API tokens listPOST`/api-tokens``store`Create a new API tokenPUT`/api-tokens/{token}``update`Update an existing API tokenDELETE`/api-tokens/{token}``destroy`Delete an API tokenThese routes provide a complete interface to generate, view, and revoke API tokens through a consistent REST API.

---

Configuration
-------------

[](#configuration)

The package configuration is located in `config/token-forge.php`. Here are the default values:

### Default Permissions

[](#default-permissions)

```
'default_permissions' => [
    'read',
],
```

These are the default permissions assigned to new API tokens if no specific permissions are provided during creation.

### Available Permissions

[](#available-permissions)

```
'available_permissions' => [
    'create',
    'read',
    'update',
    'delete',
],
```

These are the permissions available to assign to API tokens. You can modify these values to fit your application’s needs.

If you wish to change the default or available permissions, publish the configuration file using:

```
php artisan vendor:publish --tag=token-forge-config --force
```

Then, update the `config/token-forge.php` file to reflect your desired permissions.

---

Final Step: Build Assets
------------------------

[](#final-step-build-assets)

After completing the setup, ensure your front-end assets are compiled. You can use one of the following commands:

- For development:

    ```
    npm run dev
    ```
- For production:

    ```
    npm run build
    ```

This will ensure the necessary assets are available for the API token management UI.

---

Screenshots
-----------

[](#screenshots)

 [![token-forge](./assets/screenshots/snippet-1.png)](./assets/screenshots/snippet-1.png) [![token-forge](./assets/screenshots/snippet-2.png)](./assets/screenshots/snippet-2.png) [![token-forge](./assets/screenshots/snippet-3.png)](./assets/screenshots/snippet-3.png) [![token-forge](./assets/screenshots/snippet-4.png)](./assets/screenshots/snippet-4.png) [![token-forge](./assets/screenshots/snippet-5.png)](./assets/screenshots/snippet-5.png)

---

License
-------

[](#license)

This package is open-source software licensed under the [MIT license](LICENSE.md).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~2 days

Total

3

Last Release

545d ago

### Community

Maintainers

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

---

Top Contributors

[![deemonic](https://avatars.githubusercontent.com/u/25927364?v=4)](https://github.com/deemonic "deemonic (23 commits)")

---

Tags

api-token-managementlaravellaravel-breezephpblaspsofttoken-forge

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/blaspsoft-token-forge/health.svg)

```
[![Health](https://phpackages.com/badges/blaspsoft-token-forge/health.svg)](https://phpackages.com/packages/blaspsoft-token-forge)
```

###  Alternatives

[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[hasinhayder/tyro

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

6712.1k2](/packages/hasinhayder-tyro)[blaspsoft/socialiteplus

SocialitePlus is a Laravel package that simplifies social authentication by extending Laravel Socialite. It provides predefined Google, Facebook, GitHub, and LinkedIn login options for seamless integration into Laravel 12 Vue and React Starter Kits

612.8k](/packages/blaspsoft-socialiteplus)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)[pschocke/laravel-telegram-login-widget

Easily integrate Telegrams login widget into your Laravel application to send Telegram messages

1610.4k](/packages/pschocke-laravel-telegram-login-widget)[setiawanhu/sanctum-auth

Laravel package for generating user authentication feature using Laravel Sanctum

132.8k](/packages/setiawanhu-sanctum-auth)

PHPackages © 2026

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