apility / microsoft-graph-api
This package provides a PHP client library for working with the Microsoft Graph API.
v1.0.0-RC4
2023-08-25 12:48 UTC
Requires
- php: ^7.4|^8.0
- illuminate/cache: ^8.0
- illuminate/http: ^8.0
- illuminate/routing: ^8.0
- illuminate/support: ^8.0
- laravel/socialite: ^5.8
- league/flysystem: ^1.0
- league/flysystem-cached-adapter: ^1.1
- socialiteproviders/microsoft-azure: ^5.1
Requires (Dev)
- illuminate/config: ^8.0
- illuminate/container: ^8.0
- larapack/dd: ^1.1
- phpunit/phpunit: ^9.6
This package is auto-updated.
Last update: 2024-11-25 15:32:19 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
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 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 and delete operations are currently supported.
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