plokko/laravel-msgraph
Composer 安装命令:
composer require plokko/laravel-msgraph
包简介
README 文档
README
Installation
Install with composer
composer require plokko/laravel-msgraph
Laravel >=5.5 should auto discover and register the required services.
If you have laravel <5.5 you need to manually register the provider in your /config/app.php
<?php //... 'providers' => [ //... plokko\MsGraph\MsGraphServiceProvider::class, //... ], //...
Configuration
MSGRAPH_TENANT=<YOUR-TENANT-ID>
MSGRAPH_CLIENT_ID=<YOUR-CLIENT-ID>
MSGRAPH_CLIENT_SECRET=<YOUR-CLIENT-SECRET>
MSGRAPH_REDIRECT_URI=<YOUR-URL-CALLBACK>
User
Get user
You can get information about an user by id
$user = MsGraph::User()->find("USER-ID"); /**@var \Microsoft\Graph\Model\User $user**/
or by principal name
$user = MsGraph::User()->findByPrincipalName("user@principal.name");
List users
$userQuery = MsGraph::User()->list(); $userQuery ->take(5)//limit to 5 ->search('displayName:Test')//Search ->orderBy('displayName')//Order ->select(['id','displayName'])//Select fields ; $users = $userList->get(); // Execute the query /**@var \Microsoft\Graph\Model\User[] $users**/
Count users
You can count the users like the list users
$userQuery = MsGraph::User()->list(); $userQuery ->search('displayName:Test') ; $count = $userList->count(); // Execute the query /**@var int $count**/
Create user
// Prepare your user data as a Microsoft\Graph\Model\User object or as an Array of key-values $userData = new \Microsoft\Graph\Model\User([ "mailNickname" => 'UserName', "displayName" => "User Name", "givenName" => "User", "surname" => "Name", "password" => "TheUserPassword123", "jobTitle" => null, "mail" => "test@user.sample", "userPrincipalName" => "test@user.sample", "mobilePhone" => null, "businessPhones" => ['0000 123456'], "officeLocation" => null, "preferredLanguage" => null, ]); // Or $userData = [ "mailNickname" => 'UserName', "displayName" => "User Name", "givenName" => "User", "surname" => "Name", "password" => "TheUserPassword123", "jobTitle" => null, "mail" => "test@user.sample", "userPrincipalName" => "test@user.sample", "mobilePhone" => null, "businessPhones" => ['0000 123456'], "officeLocation" => null, "preferredLanguage" => null, ]; //... $password = null; //If set will overwrite user password in data $accountEnabled = null; // If the account is enabled, if set will overwrite user data, if null and not set in user data it will default to true $forcePasswordChange = false; // Will force password change on next login (see passwordProfile) MsGraph::User()->create($userData,$password,$accountEnabled,$forcePasswordChange);
Update user
// Prepare your user data as a Microsoft\Graph\Model\User object or as an Array of key-values // id or userPrincipalName are required to identify the user // You can fill only the information you want to change $userData = new \Microsoft\Graph\Model\User([ 'id' => 'your-user-id', "mailNickname" => 'UserName', ]); // Or $userData = [ "userPrincipalName" => "test@user.sample", "mailNickname" => 'UserName', ]; //... MsGraph::User()->update($userData);
Delete user
User can be deleted by id
MsGraph::User()->delete("USER-ID");
or by principal name
MsGraph::User()->deleteByPrincipalName("user@principal.name");
plokko/laravel-msgraph 适用场景与选型建议
plokko/laravel-msgraph 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 46 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「azure」 「laravel」 「microsoft」 「Microsoft graph」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 plokko/laravel-msgraph 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 plokko/laravel-msgraph 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 plokko/laravel-msgraph 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Small library to access Microsoft Windows Azure Blob Storage with a Service or a StreamWrapper.
A simple PHP package for sending messages to Microsoft Teams
Adds Silverstripe Flysystem support for using the Azure Blob adapter
Laravel 5 Queue Driver for Microsoft Azure Storage Queue
Laravel Azure storage service provider
Azure service bus Transport
统计信息
- 总下载量: 46
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-02-09