Laravel package MsGraph

David Carr

Laravel Framework Microsoft Graph API PHP & MySQL Packages

I've released a new Laravel package called MsGraph that's essentially a wrapper for working with Microsoft Graph API.

https://github.com/daveismynamelaravel/MsGraph

The package comes with a few trait classes to offer simpler functions to working with Mail, Contacts and ToDo's more will be coming over the new few months. MsGraph can also be used to call an API endpoint directly.

For instance to get a users emails:

MsGraph::get('me/messages');

or using a trait method:

Msgraph::getEmails();

When working with the endpoint you use MsGraph:: followed by the HTTP verb (get, post, put, patch or delete) then the endpoint URL and where needed an array of data.

For instance to create a contact:

$data = [
	'displayName' => request('name'),
	'givenName' => request('name'),
	'emailAddresses' => [[
		'address' => request('email'),
		'name' => request('name')
	]]
];

MsGraph::post("me/contacts", $data);

//OR use the trait
MsGraph::createContact($data);

This makes working with the Graph API simpler, I'll be writing tutorials on different use cases soon. In the meantime give it a whirl. https://github.com/daveismynamelaravel/MsGraph

Read articles directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Copyright © 2006 - 2024 DC Blog - All rights reserved.