Download the PHP package rayafort/microsoft-graph without Composer
On this page you can find all versions of the php package rayafort/microsoft-graph. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rayafort/microsoft-graph
More information about rayafort/microsoft-graph
Files in rayafort/microsoft-graph
Package microsoft-graph
Short Description The Microsoft Graph SDK for PHP
License MIT
Homepage https://developer.microsoft.com/en-us/graph
Informations about the package microsoft-graph
Get started with the Microsoft Graph SDK for PHP
Get started with the PHP Connect Sample
If you want to play around with the PHP library, you can get up and running quickly with the PHP Connect Sample. This sample will start you with a little Laravel project that helps you with registration, authentication, and making a simple call to the service.
Install the SDK
You can install the PHP SDK with Composer, either run composer require microsoft/microsoft-graph
, or edit your composer.json
file:
Get started with Microsoft Graph
Register your application
Register your application to use the Microsoft Graph API using Microsoft Azure Active Directory in your tenant's Active Directory to support work or school users for your tenant, or multiple tenants.
Authenticate with the Microsoft Graph service
The Microsoft Graph SDK for PHP does not include any default authentication implementations. The thephpleague/oauth2-client
library will handle the OAuth2 flow for you and provide a usable token for querying the Graph.
To authenticate as an application you can use the Guzzle HTTP client, which comes preinstalled with this library, for example like this:
For an integrated example on how to use Oauth2 in a Laravel application and use the Graph, see the PHP Connect Sample.
Call Microsoft Graph using the v1.0 endpoint and models
The following is an example that shows how to call Microsoft Graph.
Call Microsoft Graph using the beta endpoint and models
The following is an example that shows how to call Microsoft Graph.
Develop
Debug
You can use the library with a proxy such as Fiddler or Charles Proxy to debug requests and responses as they come across the wire. Set the proxy port on the Graph object like this:
Then, open your proxy client to view the requests & responses sent using the library.
This is especially helpful when the library does not return the results you expected to determine whether there are bugs in the API or this SDK. Therefore, you may be asked to provide this information when attempting to triage an issue you file.
Run Tests
Run
from the base directory.
The set of functional tests are meant to be run against a test account. Currently, the tests to do not restore state of the account.
Debug tests on Windows
This SDK has an XDebug run configuration that attaches the debugger to VS Code so that you can debug tests.
- Install the PHP Debug extension into Visual Studio Code.
- From the root of this repo, using PowerShell, run
php .\tests\GetPhpInfo.php | clip
from the repo root. This will copy PHP configuration information into the clipboard which we will use in the next step. - Paste your clipboard into the XDebug Installation Wizard and select Analyse my phpinfo() output.
- Follow the generated instructions for installing XDebug. Note that the
/ext
directory is located in your PHP directory. - Add the following info to your php.ini file:
Now you can hit a Visual Studio Code breakpoint in a test. Try this:
- Add a breakpoint to
testGetCalendarView
in .\tests\Functional\EventTest.php. - Run the Listen for XDebug configuration in VS Code.
- Run
.\vendor\bin\phpunit --filter testGetCalendarView
from the PowerShell terminal to run the test and hit the breakpoint.
Documentation and resources
Issues
View or log issues on the Issues tab in the repo.
Contribute
Please read our Contributing guidelines carefully for advice on how to contribute to this repo.
Copyright and license
Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT license.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.