PHPackages                             jhayiwg/msofficeauth - 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. jhayiwg/msofficeauth

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

jhayiwg/msofficeauth
====================

Laravel Office 365 server to server token management

05PHP

Since Aug 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jhayiwg/msofficeauth)[ Packagist](https://packagist.org/packages/jhayiwg/msofficeauth)[ RSS](/packages/jhayiwg-msofficeauth/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Office 365 server to server token management
====================================================

[](#laravel-office-365-server-to-server-token-management)

This package if for server to server processing.

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

[](#installation)

You can install the package via composer:

```
composer require jhayiwg/msofficeauth
```

Usage
-----

[](#usage)

Add to your .env, check  for referrence

```
OAUTH_APP_ID="XXXX"
OAUTH_APP_PASSWORD="XXXXX"
OAUTH_REDIRECT_URI=https://yoursite.loc/office/auth
OAUTH_SCOPES='openid profile offline_access user.read mail.read'
OAUTH_AUTHORITY=https://login.microsoftonline.com/common
OAUTH_AUTHORIZE_ENDPOINT=/oauth2/v2.0/authorize
OAUTH_TOKEN_ENDPOINT=/oauth2/v2.0/token

```

### Authentication and Authorization

[](#authentication-and-authorization)

After setting up, visit visiting , login to your ms account then authorize the app.

The package will store or re-generate the token on your storage folder.

### Automatic Injection

[](#automatic-injection)

To use in the controller

```
// Usage description here
namespace App\Http\Controllers;

use Microsoft\Graph\Model;
use LaraOffice\MsOfficeAuth\MsOfficeAuth;

class HomeController extends Controller
{
    public function index(MsOfficeAuth $msGraph)
    {
        $tokenExpired = $msGraph->getAccessToken() ? 'No' : 'Yes';
        $graph = $msGraph->graph();
        $user = $graph->createRequest('GET', '/me')
            ->setReturnType(Model\User::class)
            ->execute();
        $userEmail = $user->getMail();
        return view('home', compact('tokenExpired', 'userEmail'));
    }
}
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

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

Credits
-------

[](#credits)

- [Jhay](https://github.com/jhayiwg)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17201859?v=4)[Jhay Tabunan](/maintainers/jhayiwg)[@jhayiwg](https://github.com/jhayiwg)

---

Top Contributors

[![tabunan](https://avatars.githubusercontent.com/u/49105406?v=4)](https://github.com/tabunan "tabunan (2 commits)")

### Embed Badge

![Health badge](/badges/jhayiwg-msofficeauth/health.svg)

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

###  Alternatives

[vitalybaev/laravel5-dkim

Laravel 5/6 package for signing outgoing messages with DKIM.

3163.1k](/packages/vitalybaev-laravel5-dkim)

PHPackages © 2026

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