Search by

apility / microsoft-graph-api

thomas-alrek

This package provides a PHP client library for working with the Microsoft Graph API.

Package info

github.com/apility/microsoft-graph-api

pkg:composer/apility/microsoft-graph-api

Statistics

Installs: 76

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

v1.0.0 2026-10-21 10:40 UTC

This package is auto-updated.

Last update: 2026-10-21 10:41:59 UTC


README

This package provides a Laravel wwrappers for working with the Microsoft Graph API.

Table of Contents

Installation

composer require apility/microsoft-graph-api

Requires PHP 8 and Laravel 9 or later. Laravel 8 projects can stay on v1.0.0-RC4.

Laravel

Configuration

Export the configuration file:

php artisan vendor:publish --provider="Microsoft\GraphAPI\ServiceProvider" --tag="config"

Add the following environment variables to your .env file:

MICROSOFT_GRAPH_API_TENANT_ID=<your-tenant-id>
MICROSOFT_GRAPH_API_APP_ID=<your-app-id>
MICROSOFT_GRAPH_API_CLIENT_SECRET=<your-client-secret>

Usage

use Microsoft\GraphAPI\Facades\GraphAPI;

$me = GraphAPI::get('/me')->json();

Filesystem

The package also provides a Flysystem 3 adapter.

To enable this, add the following to your disk configuration in the config/filesystems.php file:

'disks' => [
    'microsoft' => [
        'driver' => 'microsoft',
        'site_id' => env('MICROSOFT_GRAPH_API_SITE_ID'),
    ],
],

You may now use the microsoft disk in your application.

$files = Storage::disk('microsoft')->allFiles('path');

Only read, list, delete, move and directory creation are currently supported. Folders report the mimetype directory.

Without Laravel (Plain PHP)

Usage

use Microsoft\GraphAPI\GraphAPI\Client;
use Microsoft\GraphAPI\GraphAPI\Auth\Credentials;

$credentials = new Credentials(
    '<your-tenant-id>',
    '<your-app-id>',
    '<your-client-secret>'
);

$client = new Client($credentials);

$me = $client->get('/me');

License

The MIT License (MIT). Please see License File for more information.

Copyright Apility AS © 2023