Download the PHP package lloadout/microsoftgraph without Composer
On this page you can find all versions of the php package lloadout/microsoftgraph. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lloadout/microsoftgraph
More information about lloadout/microsoftgraph
Files in lloadout/microsoftgraph
Package microsoftgraph
Short Description This package offers a wrapper round Microsoft Graph API
License MIT
Homepage https://github.com/lloadout/microsoftgraph
Informations about the package microsoftgraph
Laravel Microsoft graph
Use case
Laravel package for using Microsoft mail, OneDrive, Teams, Excel, Calendars and Contacts
This package makes a wrapper around the Microsoft Graph API.
- It provides a Mail driver for Microsoft mail.
- It provides a storage driver for OneDrive.
- It provides functionality to interact with Microsoft Teams.
- It provides the possibility to work with Excel, making it possible to write and read Excel files.
- It allows you to manage calendar events.
- It allows you to manage contacts.
- It allows you to read and handle mail.
You need to register an app in the Microsoft Azure Portal to use this package. Follow the steps in the Microsoft docs: https://docs.microsoft.com/en-us/graph/auth-register-app-v2
Installation
You can install the package via composer:
Add this to your .env file and fill it with the values you specified in Microsoft Azure Portal app registration.
If you created a multi-tenant app in Azure AD than you don't put your tentant id into the MS_TENANT_ID
variable but you set it to common
.
Connect your account
The package uses OAuth and provides two routes
The first redirects you to the consent screen of Microsoft
The second is the callback url you need to specify in Microsoft Azure Portal app registration as redirect uri
The callback will fire an MicrosoftGraphCallbackReceived event, you have to listen for this event in your EventServiceProvider and store the accessData to a session variable microsoftgraph-access-data
.
You can add your token store logic in a listener for this event.
The package will search for a session variable name microsoftgraph-access-data
for establishing the connection. So
please provide this variable with your accessData as value when logging in.
For example: On login, you get your accesData from the database and store it into the session
variable microsoftgraph-access-data
.
After the callback, the package will redirect you to the url you specified in the MS_REDIRECT_AFTER_CALLBACK_URL
variable. If this variable is not set, the package will redirect to the root of your application.
Mail usage
Configuration
You have to provide this API permissions: Mail.send
Set the environment variable MAIL_MAILER in your .env file
note: make sure your from address is the address you gave the consent to
Usage
Reading and handling mail
You have to provide this API permissions: Mail.Read, Mail.ReadWrite, Mail.ReadBasic
Available methods
Storage usage
Configuration
You have to provide this API permissions: Files.ReadWrite.all
add the onedrive root to your .env file:
Available methods
All methods from the Laravel Storage facade are available. https://laravel.com/docs/8.x/filesystem#configuration
Usage
The package created a disk called onedrive
. This means that you can use all the methods as described in the Laravel docs: https://laravel.com/docs/8.x/filesystem#configuration
Teams usage
Configuration
You have to provide this API permissions: Chat.ReadWrite
Available methods
Usage
First instantiate the Teams class
Get all the teams you are a member of ( additional permissions needed: Group.Read.All
)
Get alle the channels for a team ( additional permissions needed: Group.Read.All
)
Get all the chats for a user ( additional permissions needed: Chat.Read.All
)
Get a chat by a given id ( additional permissions needed: Chat.Read.All
)
Get all the members in a channel ( additional permissions needed: ChannelMessage.Read.All
)
Send a message to a channel ( additional permissions needed: ChannelMessage.Send
)
Excel usage
Configuration
You have to provide this API permissions: Files.ReadWrite.all
Available methods
Usage
First instantiate the Excel class
Load a file from OneDrive
Load a file by its id
Set cell values of a range
Calendar usage
Configuration
You have to provide this API permissions: Calendars.ReadWrite
Available methods
Usage
First instantiate the Calendar class
Get all the calendars
Get all the events for a calendar
Save an event to a calendar, the event object is a MicrosoftGraphEvent object
We made a helper function to create an event
object Calendar::makeEvent(string $starttime, string $endtime, string $timezone, string $subject, string $body, array $attendees = [], bool $isOnlineMeeting = false)
Contacts usage
Configuration
You have to provide this API permissions: Contacts.ReadWrite
Available methods
Usage
First instantiate the Contacts class
Get all the contacts
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Dieter Coopman
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of microsoftgraph with dependencies
ext-fileinfo Version *
illuminate/contracts Version ^9|^10.0|^11.0|^12.0
microsoft/microsoft-graph Version ^1.89
socialiteproviders/microsoft Version ^4.2
spatie/laravel-package-tools Version ^1.14.0