cwssrl / office365-laravel
A Office365 package for Laravel 5.2 or higher
v1.0.0
2026-08-22 11:38 UTC
Requires
- php: >=5.6.0
- laravel/framework: >=5
- league/oauth2-client: 2.9.*
- microsoft/microsoft-graph: 3.5.*
This package is auto-updated.
Last update: 2026-08-24 10:18:08 UTC
README
A Office365 package for Laravel 5.2 or higher
Installation
composer require cwssrl/office365-laravel
After install this package you have to set the service provider on your config/app.php file
Cwssrl\Office365\ServiceProvider::class,
To use the facade add this to the facades in app/config/app.php
'Office365' => Cwssrl\Office365\Facade\Office365::class,
Then you just need to publish files ! Copy and paste it
php artisan vendor:publish --provider="Cwssrl\Office365\ServiceProvider"
Get your app id and secret from Application Registration Portal then put it in Environment file
OFFICE365_APP_ID=
OFFICE365_SECRET_APP_KEY=
OFFICE365_REDIRECT_URI=http://localhost:8000/redirect
OFFICE365_SCOPES='openid profile offline_access User.Read Mail.Read'
Example Usage
<?php
namespace App\Http\Controllers;
use Cwssrl\Office365\Facade\Office365;
class AuthController extends Controller
{
public function signin()
{
$link = Office365::login();
return redirect($link);
}
public function redirect()
{
if (!request()->has('code')) {
abort(500);
}
$code = Office365::getAccessToken(request()->get('code'));
$user = Office365::getUserInfo($code['token']);
$messages = Office365::getEmails($code['token']);
dd($user, $messages);
}
}
Methods supported by this package and their parameters can be found in the API Reference
Issues
If you have any questions or issues, please open an Issue .