PHPackages                             luchavez/passport-pgt-server - 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. luchavez/passport-pgt-server

ActiveLibrary

luchavez/passport-pgt-server
============================

Laravel Passport Password Grant Tokens Server for Laravel 8|9|10

2.0.1(2y ago)0250MITPHPPHP ^8.0

Since Aug 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/luchavez-technologies/passport-pgt-server)[ Packagist](https://packagist.org/packages/luchavez/passport-pgt-server)[ Docs](https://github.com/luchavez-technologies/passport-pgt-server)[ RSS](/packages/luchavez-passport-pgt-server/feed)WikiDiscussions develop Synced 1mo ago

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

Passport Password Grant Tokens (PGC) Server for Laravel 8|9|10
==============================================================

[](#passport-password-grant-tokens-pgc-server-for-laravel-8910)

[![Latest Version on Packagist](https://camo.githubusercontent.com/79b001964e9b0287fc8a6b15b8bc953c38df0b320cc5a72729523576073ba3d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c7563686176657a2f70617373706f72742d7067742d7365727665722e737667)](https://packagist.org/packages/luchavez/passport-pgt-server)[![Total Downloads](https://camo.githubusercontent.com/dadb3bd0225c90202ec7140dd2ce8afbcef75872e1cbdb25cf73bc28cd558748/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c7563686176657a2f70617373706f72742d7067742d7365727665722e737667)](https://packagist.org/packages/luchavez/passport-pgt-server)[![GitHub Repo stars](https://camo.githubusercontent.com/99bf1e50d7b66a9d9a585a72c6b6c937520c647b83295155598f8327f9a59382/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6c7563686176657a2d746563686e6f6c6f676965732f70617373706f72742d7067742d736572766572)](https://github.com/luchavez-technologies/passport-pgt-server)[![Discord](https://camo.githubusercontent.com/bd46299a29c3cae288e34846117d44d0cb853da2dad0c376fd8bca3fc269f3b6/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f313134333734343631393935363430343239353f636f6c6f723d386339656666266c6162656c3d446973636f7264266c6f676f3d646973636f7264)](https://discord.gg/MBxxAkQAxx)[![Twitter Follow](https://camo.githubusercontent.com/516380eada3f11aaafd758d9d0b03958251eca9097ba558c3ae9ff53ee59820a/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f6c7563686176657a74656368)](https://twitter.com/luchaveztech)

**Laravel Passport** is an authentication package for Laravel. It is used by a lot of Laravel apps to authenticate users before accessing any resources. Basically, it generates an `access token` which you can then use on every request to provide identification to the `OAuth Server`.

One of Laravel Passport's mostly used authentication methods is the [`Password Grant Tokens`](https://laravel.com/docs/8.x/passport#password-grant-tokens) grant type. It is a stateless way to get `access tokens` and `refresh tokens` from the `OAuth Server`.

Take a look at [contributing.md](contributing.md) if you want to contribute to this project.

[![Passport PGT Client-Server](./images/passport-pgt.png)](./images/passport-pgt.png)

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

[](#installation)

Via Composer

```
// Install the package and its dependencies
$ composer require luchavez/passport-pgt-server --with-all-dependencies

// Publish the config, migrate Passport tables, and run passport:install
$ php artisan pgt:server:install
```

Setting Up
----------

[](#setting-up)

1. Run `php artisan migrate` to create the Passport related tables.
2. Use Passport's `Laravel\Passport\HasApiTokens` on User model.
3. Add these variables to `.env` file if you want to override the default values.

Variable NameDefault Value`PASSPORT_ACCESS_TOKEN_EXPIRES_IN`15 days`PASSPORT_REFRESH_TOKEN_EXPIRES_IN`30 days`PASSPORT_PERSONAL_ACCESS_TOKEN_EXPIRES_IN`6 days`PASSPORT_HASH_CLIENT_SECRETS`falseUsage
-----

[](#usage)

### Passport PGT Server

[](#passport-pgt-server)

The package provides a service called [**PassportPgtServer**](src/Services/PassportPgtServer.php) which you can use by calling its [helper functions](helpers/passport-pgt-server-helper.php):

1. `passportPgtServer()`
2. `passport_pgt_server()`

Here's the list of its available methods.

Method NameReturn TypeDescription`setPassportAsApiDriver``void`adds `api` authentication guard with `passport` as driver`setPassportEncryptionKeys``void`used for overriding Passport encryption keys`hashClientSecrets``bool`decides whether to hash or not client's secrets`getTokensExpiresIn``Illuminate\Support\Carbon`gets the `Carbon` datetime for access token expiration`getRefreshTokensExpiresIn``Illuminate\Support\Carbon`gets the `Carbon` datetime for refresh token expiration`getPersonalAccessTokensExpiresIn``Illuminate\Support\Carbon`gets the `Carbon` datetime for personal access token expiration`getTokenModel``string`gets the model class name`getTokenBuilder``Illuminate\Database\Eloquent\Builder`gets the model builder instance`getRefreshTokenModel``string`gets the model class name`getRefreshTokenBuilder``Illuminate\Database\Eloquent\Builder`gets the model builder instance`getPersonalAccessTokenModel``string`gets the model class name`getPersonalAccessTokenBuilder``Illuminate\Database\Eloquent\Builder`gets the model builder instance`getClientModel``string`gets the model class name`getClientBuilder``Illuminate\Database\Eloquent\Builder`gets the model builder instance### Routes

[](#routes)

By default, `laravel/passport` adds authentication related routes. This package adds two new routes: `/api/oauth/logout` and `/api/oauth/me`.

Here's the list of routes that this package provides.

MethodRouteDescriptionPOST`/oauth/token`Added by `laravel/passport`. This route generates the tokens.GET`/api/oauth/register`This route is where we register a new user.POST`/api/oauth/logout`This route revokes the current `access token` with `refresh token`.GET`/api/oauth/me`This route returns the access token's user information.*Note*: If you wish to override the logout or get self logic, feel free to do so by updating the published `passport-pgt-server` config file.

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [James Carlo Luchavez](https://github.com/luchavez-technologies)
- [All Contributors](../../contributors)

License
-------

[](#license)

MIT. Please see the [license file](license.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Total

3

Last Release

967d ago

Major Versions

1.0.0 → 2.0.02023-09-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/9751834583538187236ea6491879aa80263a43dd036aa4e4fd0a71f721a0bed4?d=identicon)[jamescarloluchavez](/maintainers/jamescarloluchavez)

---

Top Contributors

[![luchtech](https://avatars.githubusercontent.com/u/26067874?v=4)](https://github.com/luchtech "luchtech (6 commits)")

---

Tags

laraveloauth2PassportPgtServer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/luchavez-passport-pgt-server/health.svg)

```
[![Health](https://phpackages.com/badges/luchavez-passport-pgt-server/health.svg)](https://phpackages.com/packages/luchavez-passport-pgt-server)
```

###  Alternatives

[corbosman/laravel-passport-claims

Add claims to Laravel Passport JWT Tokens

88655.9k](/packages/corbosman-laravel-passport-claims)[jeremy379/laravel-openid-connect

OpenID Connect support to the PHP League's OAuth2 Server. Compatible with Laravel Passport.

55342.3k2](/packages/jeremy379-laravel-openid-connect)[johnpaulmedina/laravel-usps

USPS Addresses API v3 (OAuth2) for Laravel

2622.6k](/packages/johnpaulmedina-laravel-usps)

PHPackages © 2026

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