- What is micropole-idea/oauth2-server-httpfoundation-bridge used for?
- It adapts Symfony HttpFoundation Request and Response objects to the interfaces expected by the OAuth2 Server PHP library. This lets authorization and token endpoints work directly with HttpFoundation requests and responses in Laravel, Symfony, Silex, and similar applications. It removes the need to write custom HTTP glue between the OAuth2 library and your framework.
- How do I install micropole-idea/oauth2-server-httpfoundation-bridge with Composer?
- Install it via Composer using composer require micropole-idea/oauth2-server-httpfoundation-bridge. You will also need the OAuth2 Server PHP library and Symfony HttpFoundation available in your project. Composer will resolve compatible versions based on your application's dependencies.
- Does this package work with Laravel?
- Yes, it is intended for Laravel and other applications built on Symfony HttpFoundation. Laravel's Illuminate Http Request extends Symfony's Request, so the bridge can adapt incoming requests for OAuth2 endpoints. You still wire the OAuth2 server and routes inside your Laravel application.
- Which Laravel versions are supported?
- The package targets HttpFoundation-based applications rather than a specific Laravel release. Compatibility depends on the Symfony HttpFoundation and OAuth2 Server PHP versions your Laravel installation uses. Check Composer constraints and test against your Laravel version before production use.
- How do I use the bridge for an OAuth2 token endpoint?
- Create an OAuth2 Server instance, then wrap the incoming HttpFoundation Request with the bridge's request adapter. Pass the adapted request to the token controller and convert the OAuth2 response back to a HttpFoundation Response. This keeps OAuth2 token issuance separate from your framework controller logic.
- What OAuth2 grant types are supported?
- Grant type support comes from the underlying OAuth2 Server PHP library, not the bridge itself. The bridge only adapts HTTP requests and responses, so any grant the OAuth2 server supports can be used. Common flows include authorization code, client credentials, password, and refresh token.
- Can I use this bridge with Symfony or Silex?
- Yes, the bridge is built for Symfony HttpFoundation components. It works in Symfony, Silex, and similar PHP applications that use Request and Response objects. The same adapter approach applies outside Laravel.
- Do I need to modify my OAuth2 server configuration to use this bridge?
- No, the bridge does not change OAuth2 server configuration. It only translates HttpFoundation requests and responses to the interfaces the OAuth2 library expects. Your storage, grant types, and token settings stay configured as normal in the OAuth2 server.
- How should I test OAuth2 endpoints built with this bridge?
- Use framework HTTP tests that send real requests to your authorization and token routes. In Laravel, feature tests can post credentials to the token endpoint and assert JSON responses. Also test invalid clients, expired tokens, and unsupported grant types to cover error paths.
- Is this package a replacement for Laravel Passport or Sanctum?
- No, it is a low-level bridge for the OAuth2 Server PHP library, not a full Laravel authentication package. Passport and Sanctum provide Laravel-specific OAuth and token features, while this bridge only adapts HttpFoundation requests and responses. Use it when you specifically want to integrate oauth2-server-php into a HttpFoundation-based app.