Office 365 Graph API Connection Oauth2 Laravel 5
![Software License][ico-license]
![Coverage Status][ico-scrutinizer]
![Total Downloads][ico-downloads], (*1)
This is the first test of a package to Laravel 5 , actually is already working, is getting the connection to the Microsoft Graph api correctly, as soon as i can i will document this file better, The purpose of the project is getting bigger and extends the classes with all the options of their API (send emails, read emails, control the calendar, create events, create users, etc)., (*2)
Install
Via Composer, (*3)
``` bash
$ composer require miguel_costa/office365api, (*4)
Add the provider in the file <i>app.php</i> at folder config
``` php
Miguel_Costa\Office365API\Office365APIServiceProvider::class,
Publish the config file in your folder config/Office365API.php, (*5)
``` bash
$ php artisan vendor:publish, (*6)
Finally, configure the file <i>Office365API.php</i> at config folder with your credentials of your API at Microsoft Dev Portal </br>
<a href="https://apps.dev.microsoft.com/">App Registration Portal</a>
``` php
'CLIENT_ID' => 'your id string goes here...',
'CLIENT_SECRET' => 'your secret key goes here...',
'REDIRECT_URI' => 'your redirect url, Should be the route of laravel where will redirect once the connection is finished',
Usage
``` php
//use the namespace corretly on your controller
use Miguel_Costa\Office365API\ConnectAPI;, (*7)
//example of function to make the connection
public function redirect_connect() {
ConnectAPI::connect_officeAPI();
}, (*8)
//get the connection and redirect the user to the intended page
public function get_connection() {
ConnectAPI::get_connection();
return view('home');
}, (*9)
Get the connection at the blade view:
The connection saves an Session variable of the username and email, so after making the connection you can access the variables like that:
``` php
@if(Session::has('office365_name'))
Welcome, {{Session::get('office365_name')}}, (*10)
You are logged in with the Office365 Account:{{Session::get('office365_email')}}, (*11)
@endif
Change log
Please see CHANGELOG for more information what has changed recently., (*12)
Contributing
Please see CONTRIBUTING and CONDUCT for details., (*13)
Security
If you discover any security related issues, please email "tga_miguel_tga@hotmail.com" instead of using the issue tracker., (*14)
Credits
License
The MIT License (MIT). Please see License File for more information., (*15)