PHPackages                             dcplibrary/entra-sso - 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. dcplibrary/entra-sso

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

dcplibrary/entra-sso
====================

Simple Entra (Azure AD) SSO package for Laravel 12

v1.6.6(1mo ago)042↓50%[1 PRs](https://github.com/dcplibrary/entra-sso/pulls)MITPHPPHP ^8.2|^8.3CI passing

Since Oct 31Pushed 1mo agoCompare

[ Source](https://github.com/dcplibrary/entra-sso)[ Packagist](https://packagist.org/packages/dcplibrary/entra-sso)[ RSS](/packages/dcplibrary-entra-sso/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (26)Used By (0)

[![Dependabot Updates](https://github.com/dcplibrary/entra-sso/actions/workflows/dependabot/dependabot-updates/badge.svg)](https://github.com/dcplibrary/entra-sso/actions/workflows/dependabot/dependabot-updates) [![Semantic-Release](https://github.com/dcplibrary/entra-sso/actions/workflows/semantic-release.yml/badge.svg)](https://github.com/dcplibrary/entra-sso/actions/workflows/semantic-release.yml)

Entra SSO for Laravel
=====================

[](#entra-sso-for-laravel)

A simple, reusable Microsoft Entra (Azure AD) Single Sign-On package for Laravel 12+ with automatic user creation, role mapping, group sync, token refresh, and custom claims support.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Quick Start](#quick-start)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)
- [Troubleshooting](#troubleshooting)
- [Development](#development)
- [License](#license)

Features
--------

[](#features)

- ✅ **Simple Setup** - Interactive installation wizard handles everything
- ✅ **Azure AD/Entra Authentication** - Secure OAuth2/OIDC implementation
- ✅ **Auto-Create Users** - Users created automatically on first login
- ✅ **Role Mapping** - Map Azure AD groups to application roles
- ✅ **Group Sync** - Sync user groups from Azure AD
- ✅ **Token Refresh** - Automatic token refresh for long sessions
- ✅ **Custom Claims** - Extract additional user attributes from Azure AD
- ✅ **Built-in Dashboard** - Default landing page with user info and examples
- ✅ **Framework Agnostic** - Works with Blade, Livewire, Inertia (React/Vue)
- ✅ **Starter Kit Support** - Auto-configuration for Breeze/Jetstream/Fortify

Quick Start
-----------

[](#quick-start)

```
# 1. Install package
composer require dcplibrary/entra-sso

# 2. Run interactive wizard
php artisan entra:install

# 3. Add login button to your views
Sign in with Microsoft
```

That's it! The wizard handles Azure AD configuration, environment setup, User model updates, and migrations.

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

[](#requirements)

- **PHP** 8.2 or higher
- **Laravel** 12.0 or higher
- **Azure AD tenant** with admin access ([Setup Guide](docs/AZURE_SETUP.md))
- Any session driver (database, redis, file, etc.)

### Compatibility

[](#compatibility)

Works with all Laravel frontend stacks and starter kits:

StackStatusNotes**Blade**✅ Full supportZero conflicts**Livewire**✅ Auto-configurableUse `--fix-starter-kit` flag**Inertia (Vue/React)**✅ Auto-configurableUse `--fix-starter-kit` flag**Breeze/Jetstream**✅ Auto-configurableUse `--fix-starter-kit` flag**Starter kit conflicts?** The `entra:install --fix-starter-kit` command automatically detects and resolves authentication conflicts. See [Starter Kit Configuration](docs/STARTER_KITS.md) for details.

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

[](#installation)

### Interactive Installation (Recommended)

[](#interactive-installation-recommended)

```
composer require dcplibrary/entra-sso
php artisan entra:install
```

Notes:

- Redirect URI default: the installer sets ENTRA\_REDIRECT\_URI to "${APP\_URL}/auth/entra/callback" so your current port (e.g., :8000) is preserved.
- Group-to-role mapping: enter values without quotes (e.g., IT Admins:admin,Developers:developer). The installer will add the surrounding quotes in .env for you.

The wizard will guide you through:

1. Azure AD credentials setup
2. Environment configuration
3. User model updates
4. Database migrations
5. Starter kit conflict resolution (if needed)

**Command options:**

```
# Auto-fix starter kit conflicts
php artisan entra:install --fix-starter-kit

# Skip specific steps
php artisan entra:install --skip-user-model
php artisan entra:install --skip-env
```

### Manual Installation

[](#manual-installation)

For manual installation steps, see the [Installation Guide](docs/INSTALLATION.md).

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

**Add login button:**

```
Sign in with Microsoft
```

**Protect routes:**

```
// By role
Route::middleware(['auth', 'entra.role:admin'])->group(function () {
    Route::get('/admin', [AdminController::class, 'index']);
});

// By Azure AD group
Route::middleware(['auth', 'entra.group:IT Admins'])->group(function () {
    Route::get('/servers', [ServerController::class, 'index']);
});
```

**Use helper methods:**

```
$user = auth()->user();

// Check roles
$user->hasRole('admin');
$user->isAdmin();

// Check groups
$user->inGroup('IT Admins');
$user->getEntraGroups();

// Get custom claims
$user->getCustomClaim('department');
```

### Configuration

[](#configuration)

**Redirect after login:**

```
ENTRA_REDIRECT_AFTER_LOGIN=/dashboard
```

**Map groups to roles:**

```
ENTRA_GROUP_ROLES="IT Admins:admin,Developers:developer,Staff:user"
```

**Enable token refresh:**

```
ENTRA_ENABLE_TOKEN_REFRESH=true
```

For more usage examples, see the default dashboard at `/entra/dashboard` after logging in.

Documentation
-------------

[](#documentation)

Comprehensive guides for all features:

- **[Installation Guide](docs/INSTALLATION.md)** - Detailed installation instructions
- **[Azure AD Setup](docs/AZURE_SETUP.md)** - Configure your Azure AD application
- **[Starter Kit Configuration](docs/STARTER_KITS.md)** - Configure Breeze/Jetstream/Livewire/Inertia
- **[Role Mapping](docs/ROLE_MAPPING.md)** - Map Azure AD groups to application roles
- **[Custom Claims](docs/CUSTOM_CLAIMS.md)** - Extract additional user attributes
- **[Token Refresh](docs/TOKEN_REFRESH.md)** - Automatic token refresh for long sessions
- **[Troubleshooting](docs/TROUBLESHOOTING.md)** - Common issues and solutions

Troubleshooting
---------------

[](#troubleshooting)

**Common issues:**

- Login redirects not working → Check session driver and `APP_URL`
- "Invalid state parameter" → Clear session cache
- User not created → Enable `ENTRA_AUTO_CREATE_USERS=true`
- Groups not syncing → Check `GroupMember.Read.All` permission in Azure
- Token refresh failures → User needs to log in again

**📖 Full troubleshooting guide:** [Troubleshooting Guide](docs/TROUBLESHOOTING.md)

**Need help?** [Open an issue on GitHub](https://github.com/dcplibrary/entra-sso/issues)

Development
-----------

[](#development)

### Local Package Development

[](#local-package-development)

For local development, add a path repository to your Laravel app's `composer.json`:

```
{
    "repositories": [
        {
            "type": "path",
            "url": "../entra-sso"
        }
    ],
    "require": {
        "dcplibrary/entra-sso": "*"
    }
}
```

Then run:

```
composer update dcplibrary/entra-sso
```

### Contributing

[](#contributing)

Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

License
-------

[](#license)

MIT

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance97

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Recently: every ~33 days

Total

17

Last Release

51d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/757facf4fdcbae7fcc0f3c4ab0cf0df2f070d193f06d623dac8dc95ce877bef6?d=identicon)[dcpl-blashbrook](/maintainers/dcpl-blashbrook)

---

Top Contributors

[![dcpl-blashbrook](https://avatars.githubusercontent.com/u/7748106?v=4)](https://github.com/dcpl-blashbrook "dcpl-blashbrook (40 commits)")[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (19 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (15 commits)")[![blashbrook](https://avatars.githubusercontent.com/u/660539?v=4)](https://github.com/blashbrook "blashbrook (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dcplibrary-entra-sso/health.svg)

```
[![Health](https://phpackages.com/badges/dcplibrary-entra-sso/health.svg)](https://phpackages.com/packages/dcplibrary-entra-sso)
```

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

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

JSON Web Token Authentication for Laravel and Lumen

8359.8M52](/packages/php-open-source-saver-jwt-auth)[josiasmontag/laravel-recaptchav3

Recaptcha V3 for Laravel package

2641.6M2](/packages/josiasmontag-laravel-recaptchav3)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)[laragear/two-factor

On-premises 2FA Authentication for out-of-the-box.

339785.3k8](/packages/laragear-two-factor)[rahul900day/laravel-captcha

Different types of Captcha implementation for Laravel Application.

10715.9k](/packages/rahul900day-laravel-captcha)

PHPackages © 2026

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