OAuth2-Client is a PHP library that provides a base for integrating with OAuth 2.0 service providers.
The library solves the problem of implementing OAuth 2.0 login flows—the "Connect with Facebook/Google/etc." buttons common on web applications—which can be tricky and tedious to implement correctly. It abstracts away the complexity of RFC 6749 compliance by providing a foundation that works with any OAuth 2.0 provider conforming to the OAuth 2.0 Authorization Framework. The tool includes a GenericProvider class for connecting to any service using Bearer tokens, and developers can extend it to support provider-specific functionality beyond the base specification.
The library suits PHP applications that need to add OAuth 2.0 authentication without building integration logic from scratch. Official provider clients are available for common services like Facebook, GitHub, Google, Instagram, and LinkedIn, and the project maintains a registry of both official and third-party provider implementations. If a specific provider is not already supported, developers can create their own by extending the base library. The tool is compliant with PHP standards PSR-1, PSR-2, PSR-4, and PSR-7.
The project maintains active engagement with pull requests and contributions, with a documented contributing process and guidelines for implementing custom provider clients. The codebase supports a wide range of PHP versions, indicating sustained maintenance across multiple release cycles. The project provides comprehensive documentation including usage guides and implementation instructions for building new provider clients.