PHPackages                             good-system/laravel-o365auth - 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. good-system/laravel-o365auth

ActiveLibrary

good-system/laravel-o365auth
============================

0.1.10(7y ago)122PHP

Since Sep 16Pushed 7y agoCompare

[ Source](https://github.com/good-system/laravel-o365auth)[ Packagist](https://packagist.org/packages/good-system/laravel-o365auth)[ RSS](/packages/good-system-laravel-o365auth/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (12)Used By (0)

Office 365 PHP Auth
===================

[](#office-365-php-auth)

This package allows a Laravel application to authenticate users using their Office 365 accounts.

The package is largely based on program logic from [`microsoftgraph/php-connect-sample`](https://github.com/microsoftgraph/php-connect-sample), but aims to easier integration with Laravel 5, and utilized more Laravel specific things.

Prerequisite
------------

[](#prerequisite)

### Microsoft Application and `.env`

[](#microsoft-application-and-env)

Create an application at . And add the following to .env file with the application's parameters.

```
# If any of the following is missing, authentication will fail.
O365_DOMAIN=ALLOWED-EMAIL-DOMAIN-NAMES,SEPARATED-BY-COMMA
O365_CLIENT_ID=YOUR-APPLICATION-ID-OR-CLIENT-ID-IN-CREATED-MICROSOFT-APPLICATION
O365_CLIENT_SECRET=YOUR-CLIENT-SECRETE-OR-CLIENT-PASSWORD-IN-CREATED-MICROSOFT-APPLICATION
# This needs to be the full URL (https).
O365_REDIRECT_URL=YOUR-REDIRECT-URL-IN-CREATED-MICROSOFT-APPLICATION

```

### User Model

[](#user-model)

This package will be looking for a Laravel model `\O365User`. This could be an alias of `App\User` or other user class such as `GoodSystem\User`, explicitly set in the application.

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

[](#installation)

Run `composer require good-system/o365auth` under Laraval application root directory.

Laravel (5.6 and newer) should "discover" the package, without having to add service provider to `config/app.php`.

### Required Laravel Version

[](#required-laravel-version)

This package might work with Laravel framework before 5.7, it's not been tested.

Error Page Templates
--------------------

[](#error-page-templates)

Error templates in package will be looked up and used if exist. Otherwise, fall back to default Laravel error display.

Expected Behaviors
------------------

[](#expected-behaviors)

### Default Routes

[](#default-routes)

Two default routes are provided:

- `/o365auth/init`
- `/o365auth/redirect`

Users should always start at `/o365auth/init`, and then expect to be redirected to Office 365 authentication page at `https://login.microsoftonline.com/common/oauth2/v2.0/authorize`, with parameters.

### 1. Happy Scenario

[](#1-happy-scenario)

Upon successful authentication with an Office 365 account on any of the domains specified by "O365\_DOMAIN" in `.env`,

- if not exists in the system, and user model is configured properly, user record is added to the system (retrieved if already exists)
- system access is granted (Laravel manual authentication)
- user is finally redirected to the previous page or web root `/` (it doesn't have anything to do with "O365\_REDIRECT\_URL" in `.env`)
- Both new user and existing user will be able to bypass email verification, if not yet verified (verification flag will be set manually)

### 2. Laravel Authentication Error

[](#2-laravel-authentication-error)

If above #2 fails, which is unlikely, expect the system to throw a `500` error -- something really unexpected.

### 3. User Model Error

[](#3-user-model-error)

If above #1 fails due to bad configuration for user model, which is possible (but not expected), or some unknown error while adding user to system, also expect system to throw a `500` error.

### 4. Bad Data Coming from Microsoft

[](#4-bad-data-coming-from-microsoft)

Could be one of the several scenarios.

### 5. Email Not on The Allowed Domains List

[](#5-email-not-on-the-allowed-domains-list)

Expect the system to throw a `403` error.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

Total

11

Last Release

2598d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/818b3b273afad37f8e31087d6e399403493e153934beeb9e78480ce42ee9719e?d=identicon)[good-system](/maintainers/good-system)

---

Top Contributors

[![singingfox](https://avatars.githubusercontent.com/u/34545721?v=4)](https://github.com/singingfox "singingfox (11 commits)")

### Embed Badge

![Health badge](/badges/good-system-laravel-o365auth/health.svg)

```
[![Health](https://phpackages.com/badges/good-system-laravel-o365auth/health.svg)](https://phpackages.com/packages/good-system-laravel-o365auth)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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