1. Go to this page and download the library: Download rayafort/microsoft-graph library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Microsoft\Graph\Graph;
use Microsoft\Graph\Model;
class UsageExample
{
public function run()
{
$accessToken = 'xxx';
$graph = new Graph();
$graph->setAccessToken($accessToken);
$user = $graph->createRequest("GET", "/me")
->setReturnType(Model\User::class)
->execute();
echo "Hello, I am $user->getGivenName() ";
}
}
use Microsoft\Graph\Graph;
use Beta\Microsoft\Graph\Model as BetaModel;
class UsageExample
{
public function run()
{
$accessToken = 'xxx';
$graph = new Graph();
$graph->setAccessToken($accessToken);
$user = $graph->setApiVersion("beta")
->createRequest("GET", "/me")
->setReturnType(BetaModel\User::class)
->execute();
echo "Hello, I am $user->getGivenName() ";
}
}
$graph->setProxyPort("localhost:8888");
vendor/bin/phpunit --exclude-group functional
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.