microsoft/microsoft-graph
The Microsoft Graph SDK for PHP lets you authenticate with Azure AD and call Microsoft 365 APIs to work with users, mail, files, calendars, and Teams from your PHP apps. Requires PHP 8.2+ and Composer.
authorization_code context supports "Sign in with Microsoft" and incremental consent screens; the on_behalf_of flow supports service-to-service scenarios behind an authenticated user. This shapes onboarding UX decisions (consent prompts, tenant admin approval, re-consent on scope expansion) and is a gate on enterprise deals.client_credentials (app-only, no user) vs. delegated flows is a real product fork: background automation and admin tools choose app-only; end-user features choose delegated. This decision drives the permission-request story in sales and security reviews, and the national-cloud support (added in 2.23.0) decides whether government/sovereign-cloud customers are addressable.GraphServiceClient independently. This is an architecture decision with a real maintenance bill attached, given the SDK's monthly regeneration cadence.Adopt when most of the following hold:
Look elsewhere when:
NOASSERTION while the repository README states MIT. Legal will want that reconciled in writing before this enters a regulated build.->wait(). Teams that expect synchronous ergonomics will write subtly broken code (unawaited calls, swallowed exceptions) unless you wrap it.For executives. This is Microsoft's own client library for Microsoft Graph — the single API behind Outlook, Teams, SharePoint, OneDrive, and Entra ID. It is free, MIT-licensed, and maintained on a published twice-monthly cadence by the vendor that owns the API. Choosing it means we do not build or maintain an integration layer ourselves, we inherit Microsoft's schema and auth work as the API evolves, and we reduce the single largest risk in any M365 feature — getting authentication and permissions subtly wrong. The commercial upside is access to enterprise customers who require Microsoft identity integration and tenant-admin-approved access; the cost is a dependency, a PHP 8.2 floor, and a security review.
For engineering. It is an official, actively released SDK sitting on Kiota abstractions, with clear separation between authentication (token request contexts for client_credentials, authorization_code, and on_behalf_of, secret- and certificate-based) and the generated Graph surface. Tokens are fetched, cached, and refreshed for you. The trade-offs to plan for: responses are promises — every operation needs ->wait() — so we should own a thin internal wrapper rather than calling the client directly from controllers; PHP 8.2+ is required; models regenerate on a monthly-ish schedule, so we pin versions and read the upgrade guide before bumping. The dependency has a small footprint in the ecosystem and few downstream consumers, meaning we will be doing our own integration testing rather than leaning on a large community corpus — budget a spike before committing a quarter to it. Recommended first slice: one app-only flow against a single endpoint (e.g., user read) behind our wrapper, with token caching and error mapping proven, before any roadmap feature depends on it.
How can I help you explore Laravel packages today?