PHPackages                             karelvanzijl/sanctum-tokens - 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. karelvanzijl/sanctum-tokens

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

karelvanzijl/sanctum-tokens
===========================

A Laravel Nova resource tool for sanctum tokens.

v1.0.1(3y ago)02MITVuePHP ^7.3|^8.0

Since Apr 22Pushed 3y agoCompare

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

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

Create a Sanctum Personal Access Tokens in Nova
===============================================

[](#create-a-sanctum-personal-access-tokens-in-nova)

This package allows you to use [Sanctum](https://laravel.com/docs/7.x/sanctum) to generate a Personal Access Tokens in [Nova](https://nova.laravel.com/).

Screenshot
----------

[](#screenshot)

[![View without any tokens](https://user-images.githubusercontent.com/22965241/175853019-a161fd10-5fde-4895-a094-26a7555f45dc.png)](https://user-images.githubusercontent.com/22965241/175853019-a161fd10-5fde-4895-a094-26a7555f45dc.png)[![Create Token View](https://user-images.githubusercontent.com/22965241/175853009-68f7d0bc-087a-49af-bbec-2d237e0330b7.png)](https://user-images.githubusercontent.com/22965241/175853009-68f7d0bc-087a-49af-bbec-2d237e0330b7.png)[![Post Create Token View](https://user-images.githubusercontent.com/22965241/175853005-466ccddb-4c25-42a0-9af0-42a4a088d249.png)](https://user-images.githubusercontent.com/22965241/175853005-466ccddb-4c25-42a0-9af0-42a4a088d249.png)[![View with single token](https://user-images.githubusercontent.com/22965241/175852995-5431d46f-daec-4831-9596-8d551a050286.png)](https://user-images.githubusercontent.com/22965241/175852995-5431d46f-daec-4831-9596-8d551a050286.png)[![Revoke Token Prompt](https://user-images.githubusercontent.com/22965241/175853279-fdd28f9c-d6ae-4abb-b769-12fc70cf2b23.png)](https://user-images.githubusercontent.com/22965241/175853279-fdd28f9c-d6ae-4abb-b769-12fc70cf2b23.png)

Prerequisites
-------------

[](#prerequisites)

1. [Install and Configure Sanctum](https://laravel.com/docs/7.x/sanctum#installation)
2. [Have Laravel Nova](https://nova.laravel.com/)
    - For Nova 4, use v2
    - Nova 3, use v1

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

[](#installation)

```
composer require karelvanzijl/sanctum-tokens

```

Register the plugin by adding `SanctumTokens::make()` to the array of fields in the Nova resource. Make sure the `HasApiTokens` trait from the Sanctum package has been added to your model.

```
use Karelvanzijl\SanctumTokens\SanctumTokens;

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function fields(Request $request)
{
    return [
        ID::make('ID', 'id')->sortable(),
        ...
        SanctumTokens::make(),
    ];
}
```

Features
--------

[](#features)

### Hide Abilities

[](#hide-abilities)

You can hide the reference to the token abilities from the UI by calling the `hideAbilities()` method on the field.

```
use Karelvanzijl\SanctumTokens\SanctumTokens;

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function fields(Request $request)
{
    return [
        ID::make('ID', 'id')->sortable(),
        ...
        SanctumTokens::make()->hideAbilities(),
    ];
}
```

### Set Default Abilities

[](#set-default-abilities)

If you don't want to use the default `*` token ability you can set your own by simply passing an array of strings to the `defaultAbilities()` method on the field.

This works well with the the `hideAbilities()` method if you want to hide the abilities logic from your users.

```
use Karelvanzijl\SanctumTokens\SanctumTokens;

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function fields(Request $request)
{
    return [
        ID::make('ID', 'id')->sortable(),
        ...
        SanctumTokens::make()->defaultAbilities(['foo', 'bar-baz']),
    ];
}
```

### Localization

[](#localization)

Publish the package language files to your application's `resources/lang/vendor` directory:

```
php artisan vendor:publish --provider="Karelvanzijl\SanctumTokens\ToolServiceProvider"

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity50

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

Total

2

Last Release

1117d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/230c14f09339bc565e0603752788ca42daa62b8caf3187d571989732c60b28e2?d=identicon)[karelvanzijl](/maintainers/karelvanzijl)

---

Top Contributors

[![JeffBeltran](https://avatars.githubusercontent.com/u/22965241?v=4)](https://github.com/JeffBeltran "JeffBeltran (44 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (24 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![karelvanzijl](https://avatars.githubusercontent.com/u/13943182?v=4)](https://github.com/karelvanzijl "karelvanzijl (5 commits)")[![craftyshaun](https://avatars.githubusercontent.com/u/774763?v=4)](https://github.com/craftyshaun "craftyshaun (2 commits)")[![tpetry](https://avatars.githubusercontent.com/u/315686?v=4)](https://github.com/tpetry "tpetry (1 commits)")[![chrisbjr](https://avatars.githubusercontent.com/u/571279?v=4)](https://github.com/chrisbjr "chrisbjr (1 commits)")[![ryanmitchell](https://avatars.githubusercontent.com/u/51899?v=4)](https://github.com/ryanmitchell "ryanmitchell (1 commits)")[![theofanisv](https://avatars.githubusercontent.com/u/6011795?v=4)](https://github.com/theofanisv "theofanisv (1 commits)")[![anibalsanchez](https://avatars.githubusercontent.com/u/385780?v=4)](https://github.com/anibalsanchez "anibalsanchez (1 commits)")

---

Tags

laravelsanctumnova

### Embed Badge

![Health badge](/badges/karelvanzijl-sanctum-tokens/health.svg)

```
[![Health](https://phpackages.com/badges/karelvanzijl-sanctum-tokens/health.svg)](https://phpackages.com/packages/karelvanzijl-sanctum-tokens)
```

###  Alternatives

[vyuldashev/nova-permission

A Laravel Nova tool for Spatie's Permission library.

4332.5M3](/packages/vyuldashev-nova-permission)[kabbouchi/nova-impersonate

A Laravel Nova field allows you to authenticate as your users.

2352.1M](/packages/kabbouchi-nova-impersonate)[jeffbeltran/sanctum-tokens

A Laravel Nova resource tool for sanctum tokens.

54557.4k](/packages/jeffbeltran-sanctum-tokens)[kiritokatklian/nova-permission

A Laravel Nova tool for Spatie's Permission library.

791.1M3](/packages/kiritokatklian-nova-permission)[sereny/nova-permissions

Laravel Nova - Roles &amp; Permissions

86388.6k1](/packages/sereny-nova-permissions)[visanduma/nova-two-factor

Nova Two Factor Authentication

56621.3k](/packages/visanduma-nova-two-factor)

PHPackages © 2026

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