TUTORIAL – PHP – MICROSOFT GRAPH – IMPLEMENT OFFICE365 INTO ANY WEBSITE
Let's start
Microsoft Graph SDK for PHP
You’ll need to install microsoft/microsoft-graph via composer into your PHP project. You can do this by:
composer require microsoft/microsoft-graph
or via your composer file composer.json
{“require”:{“microsoft/microsoft-graph”: “^1.5”}}


If you don’t know how to install composer you can read about it here: How to install composer to your php project
The GIT repository of msgraph-sdk-php can be found here: https://github.com/microsoftgraph/msgraph-sdk-php
The overview of GRAPH can be found here: https://docs.microsoft.com/en-us/graph/overview
ONEDRIVE GRAPH: https://docs.microsoft.com/en-us/onedrive/developer/rest-api/index?view=odsp-graph-online
The complete reference of possible usages with explanation for API v.1.0: https://docs.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0


CURL
adapt your php curl so you won't get into trouble


cacert.pem can be downloaded directly from our site: cacert.pem
if you don’t set the certificate you will encounter errors like:
RequestException in CurlFactory.php line 187: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
GRAPH has no authentication method included, so you will need to install one with oauth2.
You can do that via composer require league/oauth2-client






Please take note that we are working with callbacks in order to get our access tokens, so we need to provide the corresponding function for this callback "localhost\mscallback" or however you want to name this endpoint, also replace localhost with your domain. We will do that later.
This is the content of our TokenCache.php:




You see that we point each route to a specific function inside of our AuthController.
To have a very rudimentary Login and Logout possibility for connection with GRAPH you can use the following HTML:




You need to be a registered member to rate this.


I just couldn’t go away your site before suggesting that I extremely enjoyed the standard info an individual provide in your guests?
Is going to be again steadily in order to inspect new posts
Superb site you have here but I was curious if you knew of any message boards that
cover the same topics discussed in this article? I’d really like to be a part of community where I can get feed-back from other experienced people that share the same interest.
I am regular reader, how are you everybody? This paragraph posted at this site
is actually fastidious.
I appreciate, result in I discovered exactly what I was taking a look
for. You’ve ended my four day long hunt! God Bless you man. Have a nice day.
Bye
Hi there very cool blog!! Man .. Excellent .. Wonderful ..
I will bookmark your web site and take the feeds also?
I’m happy to find so many helpful info right here within the put up, we want
work out extra techniques on this regard, thank you for sharing.
. . . . .
Write more, thats all I have to say. Literally, it seems as though you relied on the video to
make your point. You obviously know what youre talking about, why waste your intelligence on just posting videos to
your site when you could be giving us something enlightening to read?
This is a topic which is near to my heart… Many thanks! Exactly where are your contact details though?
A big thank you for your blog post. Cool.
I’m impressed, I have to admit. Seldom do I encounter a
blog that’s both educative and entertaining, and let me tell you, you’ve hit the nail
on the head. The issue is an issue that too few people are speaking
intelligently about. I am very happy I came across this in my hunt for something
concerning this.
Its like you learn my mind! You seem to grasp so much about this, like you wrote the guide in it or
something. I believe that you just can do with some p.c.
to pressure the message house a bit, but instead of that,
that is wonderful blog. A fantastic read. I’ll certainly
be back.
Great post. I was checking continuously this weblog and I am inspired!
Very useful information specially the closing part 🙂 I
take care of such info a lot. I used to be seeking
this certain information for a long time. Thank
you and good luck.
You are so awesome! I do not suppose I’ve truly read something like that before.
So good to find someone with some original thoughts on this issue.
Seriously.. thanks for starting this up. This web site is
something that’s needed on the web, someone with some originality!
I want to to thank you for this very good read!!
I definitely enjoyed every little bit of it. I have got you
book-marked to look at new things you post… adreamoftrains website hosting
Informative article, just what I wanted to find.