Download the PHP package adnanhussainturki/microsoft-api-php without Composer
On this page you can find all versions of the php package adnanhussainturki/microsoft-api-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adnanhussainturki/microsoft-api-php
More information about adnanhussainturki/microsoft-api-php
Files in adnanhussainturki/microsoft-api-php
Package microsoft-api-php
Short Description PHP Wrapper the Microsoft Graph API
License MIT
Homepage https://github.com/AdnanHussainTurki/microsoft-api-php
Informations about the package microsoft-api-php
Microsoft API PHP Wrapper
Microsoft provides its application registration via its server side of giant service service called Azure. In order to use its API and this wrapper you must need to register your own Microsoft App in Azure Portal.
Installation
You can install this library to your project via composer using the following command:
composer require adnanhussainturki/microsoft-api-php
Authentication
Microsoft uses OAuth 2.0 meaning Access Token is the key to pull data from the Microsoft servers on behalf of the user for which access token is generated. Access token is generated only for the nodes for which the authenticated user allowed your app to.
These nodes are called as scopes which dictates what types of data and functions can the app perform on the behalf of the authenticated user (against her access token). You can get the applicable scopes, in this document.
This wrapper also supports tenants. If you want users of only your organization (Azure) to use this app, you can use respective tenant otherwise common will work fine for general microsoft user authentication.
Fetching & Setting Access Token (Shorter life)
Fetching user data
Once the access token is set to the wrapper, you can just initialize the User model and the related data will get pulled out for you.
Fetching Refresh Token (Longer Life)
For fetching refresh token along with the access token, you need to provide offline_access
as an scope and then fetch access token. On the callback, you will recieve refresh token along with access token.
Using Refresh Token
If you have active refresh token for an user, you do need ask for the user permission to get accesss token against that user. You can set the refresh token to the wrapper and the wrapper will fetch access token for you against it.
Buy me a coffee
How to contribute
- Create a fork, make changes and send a pull request.
- Raise a issue
License
Licensed under Apache 2.0. You can check its details here.