PHPackages                             corbosman/laravel-passport-claims - 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. corbosman/laravel-passport-claims

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

corbosman/laravel-passport-claims
=================================

Add claims to Laravel Passport JWT Tokens

9.0.0(1mo ago)88655.9k—0.6%17[2 PRs](https://github.com/corbosman/laravel-passport-claims/pulls)MITPHPCI passing

Since Apr 24Pushed 1mo ago5 watchersCompare

[ Source](https://github.com/corbosman/laravel-passport-claims)[ Packagist](https://packagist.org/packages/corbosman/laravel-passport-claims)[ Docs](https://github.com/corbosman/laravel-passport-claims)[ RSS](/packages/corbosman-laravel-passport-claims/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (16)Versions (38)Used By (0)

laravel-passport-claims
=======================

[](#laravel-passport-claims)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c1292d94ba53469dbabb08ad958689f3e27ed6cec6ca3398ff3ccccb90dcb0ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f72626f736d616e2f6c61726176656c2d70617373706f72742d636c61696d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/corbosman/laravel-passport-claims)[![Total Downloads](https://camo.githubusercontent.com/ce9773cd0a05f039633b5c57bb39bbbeaecac44d9702acf7050516fab1bec6e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f72626f736d616e2f6c61726176656c2d70617373706f72742d636c61696d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/corbosman/laravel-passport-claims)[![build](https://github.com/corbosman/laravel-passport-claims/workflows/build/badge.svg?branch=master)](https://github.com/corbosman/laravel-passport-claims/workflows/build/badge.svg?branch=master)[![license](https://camo.githubusercontent.com/aea5ffc60eab1c02f2dd9f680563f95e8674235b8b01e1b80711bbaedf0526f5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f72626f736d616e2f6c61726176656c2d70617373706f72742d636c61696d73)](https://camo.githubusercontent.com/aea5ffc60eab1c02f2dd9f680563f95e8674235b8b01e1b80711bbaedf0526f5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f72626f736d616e2f6c61726176656c2d70617373706f72742d636c61696d73)

This package allows you to add claims to Laravel Passport JWT Tokens. If you have questions or comments, please open an issue.

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

[](#installation)

This package only supports Laravel 11 and 12. You can try to use older versions of this package but it's not supported.

Via Composer

```
composer require corbosman/laravel-passport-claims
```

Usage
-----

[](#usage)

This package sends the AccessToken class through a pipeline of classes to collect all the claims, similar to how laravel middleware works. Each class adds a claim to the token. For each claim that you want to add, you need to create a class like the example below. You can of course add multiple claims in a single class as well.

You can use an artisan command to generate a class for you. Just provide a path from the root of your app folder. The example below will create a class app/Claims/CustomClaim.php

```
php artisan claim:generate Claims/CustomClaim
```

```
