Download the PHP package yosefa/microsoft-graph-api-php without Composer
On this page you can find all versions of the php package yosefa/microsoft-graph-api-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yosefa/microsoft-graph-api-php
More information about yosefa/microsoft-graph-api-php
Files in yosefa/microsoft-graph-api-php
Package microsoft-graph-api-php
Short Description Currently a simple utility for login using microsoft graph api php.
License MIT
Informations about the package microsoft-graph-api-php
Microsoft Graph API PHP Library
Description
A lightweight PHP library for authenticating and retrieving user data from Microsoft Graph API using OAuth 2.0. This library simplifies the process of obtaining access tokens and fetching user information through Microsoft's authentication system.
Features
- Easy Microsoft OAuth 2.0 authentication.
- Token retrieval and management.
- Fetch user profile information.
- Supports multiple tenants and scopes.
- Built with Guzzle HTTP client and Microsoft Graph SDK.
Prerequisites
- PHP 7.4+
- Composer
- Microsoft Azure Active Directory application credentials
Installation
Install the library using Composer:
Configuration
- Create a Microsoft Azure AD application in the Azure Portal
- Obtain the following credentials:
- Client ID
- Client Secret
- Tenant ID
- Redirect URI
Usage Example
Method Reference
Constructor
Methods
get_url_auth(): Generate Microsoft OAuth authorization URLget_token($code): Exchange authorization code for access tokenget_data($code): Retrieve authenticated user's profile information
Scopes
Default scope is User.Read. You can specify multiple scopes during initialization:
Error Handling
The library returns objects with a valid property:
true: Successful operationfalse: Operation failed
Check the valid property and handle errors accordingly.
Dependencies
Contributing
Contributions are welcome! Please submit pull requests or open issues on the project repository.