Download the PHP package noardcode/laravel-microsoft-graph without Composer
On this page you can find all versions of the php package noardcode/laravel-microsoft-graph. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download noardcode/laravel-microsoft-graph
More information about noardcode/laravel-microsoft-graph
Files in noardcode/laravel-microsoft-graph
Package laravel-microsoft-graph
Short Description This Laravel package provides a convenient interface for the Microsoft Graph API.
License MIT
Homepage https://github.com/noardcode/laravel-microsoft-graph
Informations about the package laravel-microsoft-graph
Laravel Microsoft Graph
This Laravel package provides a convenient wrapper for the Microsoft Graph PHP library.
Installation
Publish configuration
Publish the supplied configuration file (config/microsoft-graph.php). This file should be used to configure your Graph API connection.
Register your application with the Microsoft identity platform
To connect with the Microsoft Graph API you first need to register your application with the Microsoft identity platform. This platform will provide you with all the required IDs en secrets:
- Client ID
- Client Secret
- Tenant ID
- Object ID
Registering your application can be done through the Microsoft Azure portal. In the menu select "Azure Active Directory" > "App Registrations" > "New registration" to create a new registration.
In the registration form you will be asked to provide a "Redirect URI". You'll find more information about this URI in the "xyz" section below.
For more information on the application registration visit the Microsoft Documentation.
How to use this package
Besides easy access to several Microsoft Graph API endpoints this package provides an easy to use OAuth2.0 wrapper to authorize with the API/Microsoft identity platform.
The authorization requires two routes:
- The first route redirects the user to the Microsoft identity platform to let the user consent with the requested permissions your applications requests;
- The second (GET) route (or redirect_uri) is the URI the Microsoft identity platform redirects to after consent has been given (webhook).
Below is an example controller for handling these:
Be sure to add the correct redirect URI to the configuration or .env file.
Determine permissions
Permissions determine which resources your application will have access to. These permissions will be shown to the user when the consent is requested and can be set in the configuration as a space seperated string.
More information on the available permissions can be found in the permission reference.
Doing requests
First instantiate the MicrosoftGraphClient with the retrieved access token as constructor argument:
or via the setter:
Now you can retrieve the original Microsoft Graph library directly:
This way you can access all available endpoints as described with this package. An other way to use this package is to use convenient predefined methods, for example:
Not all data is already accessible via these methods but for the ones that are they provide an easy interface with the Microsoft Graph API which also return ready to use value objects and/or collections.
Currently the following methods are implemented:
- users() // Retrieve information of the signed in user or other organization users.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on Github.
Pull Requests
- PSR-2 Coding Standard - The easiest way to apply the conventions is to install PHP Code Sniffer.
- Document any change in behaviour - Make sure the
README.md
and any other relevant documentation are kept up-to-date. - Create feature branches - Don't ask us to pull from your master branch.
- One pull request per feature - If you want to do more than one thing, send multiple pull requests.
License
The MIT License (MIT). Please see License File for more information.
References
All versions of laravel-microsoft-graph with dependencies
ext-json Version *
laravel/framework Version ^7.0
microsoft/microsoft-graph Version ^1.15