PHPackages                             customergauge/cognito - 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. customergauge/cognito

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

customergauge/cognito
=====================

AWS Cognito provider for Laravel Authentication

2.0.0(1y ago)2247.8k↓20.3%6MITPHPPHP &gt;=8.1

Since Oct 14Pushed 1y ago7 watchersCompare

[ Source](https://github.com/cgauge/laravel-cognito-provider)[ Packagist](https://packagist.org/packages/customergauge/cognito)[ RSS](/packages/customergauge-cognito/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (8)Versions (7)Used By (0)

[![Build](https://github.com/cgauge/laravel-cognito-provider/workflows/Tests/badge.svg)](https://github.com/cgauge/laravel-cognito-provider/workflows/Tests/badge.svg)[![Code Coverage](https://camo.githubusercontent.com/c8e497c89ccead5714b49b10468dedc2dad63841fad124a1d31420efc435ad32/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6367617567652f6c61726176656c2d636f676e69746f2d70726f76696465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/cgauge/laravel-cognito-provider/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/02d36e89ce468f80bd44045f0a81c8dc9a992b23c1861f2a17683666e161e755/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6367617567652f6c61726176656c2d636f676e69746f2d70726f76696465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/cgauge/laravel-cognito-provider/?branch=master)

Laravel Cognito Provider 🔑
==========================

[](#laravel-cognito-provider-)

This library provides a CognitoUserProvider for Laravel.

Installation
============

[](#installation)

```
composer require customergauge/cognito
```

Usage
=====

[](#usage)

### Auth configuration

[](#auth-configuration)

In the `auth.php` file, add the following settings:

Default Guard

```
    'defaults' => [
        'guard' => 'cognito-token',
        'passwords' => 'users',
    ],
```

The new Guard configuration

```
    'guards' => [
        'cognito-token' => [
            'driver' => 'token',
            'provider' => 'cognito-provider',
            'storage_key' => 'cognito_token',
            'hash' => false,
        ],
    ],
```

The User Provider configuration

```
    'providers' => [
        'cognito-provider' => [
            'driver' => \CustomerGauge\Cognito\CognitoUserProvider::class,
        ],
    ],
```

Cognito Environment Variables

```
    /*
    |--------------------------------------------------------------------------
    | Cognito Custom Configuration
    |--------------------------------------------------------------------------
    |
    | The following configuration is not part of standard Laravel application.
    | We use it to configure the CognitoUserProvider process so that we can
    | properly validate the JWT token provided by AWS Cognito.
    |
    */

    'cognito' => [
        'pool' => env('AWS_COGNITO_USER_POOL_ID'),
        'region' => env('AWS_COGNITO_USER_POOL_REGION'),
    ],
```

### Auth Middleware

[](#auth-middleware)

Configure the `auth` middleware at `App\Http\Kernel` with `'auth:cognito-token'`

### UserFactory

[](#userfactory)

The last thing you'll need is to provide your own implementation of `UserFactory` and register it in a ServiceProvider.

```
final class CognitoUserFactory implements UserFactory
{
    public function make(array $payload): ?Authenticatable
    {
        return new MyUserObject(
            $payload['username'],
            $payload['custom:my_custom_cognito_attribute'],
        );
    }
}

```

In the provider:

```
$this->app->bind(CustomerGauge\Cognito\Contracts\UserFactory, App\Auth\CognitoUserFactory::class);

```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 84.6% 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 ~267 days

Recently: every ~318 days

Total

6

Last Release

705d ago

Major Versions

1.4.0 → 2.0.02024-06-12

PHP version history (3 changes)1.0.0PHP ^7.3

1.1.0PHP &gt;=7.3

2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0325707319c1497846deddeb429fef8d7510c299c2e764d7e5a05b198fcb4d28?d=identicon)[Deleu](/maintainers/Deleu)

---

Top Contributors

[![deleugpn](https://avatars.githubusercontent.com/u/9533181?v=4)](https://github.com/deleugpn "deleugpn (22 commits)")[![abdala](https://avatars.githubusercontent.com/u/219340?v=4)](https://github.com/abdala "abdala (3 commits)")[![noodlelive](https://avatars.githubusercontent.com/u/6471444?v=4)](https://github.com/noodlelive "noodlelive (1 commits)")

---

Tags

laravelawsAuthenticationCognito

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/customergauge-cognito/health.svg)

```
[![Health](https://phpackages.com/badges/customergauge-cognito/health.svg)](https://phpackages.com/packages/customergauge-cognito)
```

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[ellaisys/aws-cognito

AWS Cognito package that allows Auth and other related features using the AWS SDK for PHP

120220.7k1](/packages/ellaisys-aws-cognito)[pmill/aws-cognito

A PHP client for AWS Cognito user pools

74266.0k3](/packages/pmill-aws-cognito)[pallant/laravel-aws-cognito-auth

An authentication driver for Laravel for authenticating users in AWS Cognito User Pools

777.7k](/packages/pallant-laravel-aws-cognito-auth)[benbjurstrom/cognito-jwt-guard

A laravel auth guard for JSON Web Tokens issued by Amazon AWS Cognito

1113.1k](/packages/benbjurstrom-cognito-jwt-guard)

PHPackages © 2026

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