moathdev / office365-laravel
为 Laravel 5.2 或更高版本提供的 Office365 包
1.0.1
2021-03-25 14:30 UTC
Requires
- php: >=5.6.0
- illuminate/support: ~5.1
- league/oauth2-client: 2.3.*
- microsoft/microsoft-graph: 1.0.*
This package is not auto-updated.
Last update: 2024-09-17 02:57:26 UTC
README
为 Laravel 5.2 或更高版本提供的 Office365 包
安装
composer require moathdev/office365-laravel
安装此包后,您需要在 config/app.php 文件中设置服务提供者
Moathdev\Office365\ServiceProvider::class,
要使用外观,请将以下内容添加到 app/config/app.php 中的 facades
'Office365' => Moathdev\Office365\Facade\Office365::class,
然后,您只需要发布文件!复制并粘贴即可
php artisan vendor:publish --provider="Moathdev\Office365\ServiceProvider"
从应用程序注册门户获取您的应用程序 ID 和密钥,然后将其放入 环境 文件中
OFFICE365_APP_ID=
OFFICE365_SECRET_APP_KEY=
OFFICE365_REDIRECT_URI=https://:8000/redirect
OFFICE365_SCOPES='openid profile offline_access User.Read Mail.Read'
示例用法
<?php
namespace App\Http\Controllers;
use Moathdev\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);
}
}
此包支持的函数及其参数可以在API 参考中找到
问题
If you have any questions or issues, please open an Issue .