定制 plokko/laravel-msgraph 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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");

统计信息

  • 总下载量: 46
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-02-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固