- How do I install SocialiteProviders/Manager in a Laravel project?
- Run `composer require socialiteproviders/manager` to install the package. No additional configuration is needed for basic usage, but you’ll need to register providers via an event listener or service provider. Follow the [README’s setup guide](https://github.com/SocialiteProviders/Manager) for detailed steps.
- Does this package support Lumen, and how does it differ from Laravel?
- Yes, it fully supports Lumen. The key difference is that Lumen lacks Laravel’s service container bootstrapping, so you’ll need to manually register the manager via a service provider or bootstrapped file. Stateless mode is also more relevant for Lumen due to its stateless nature.
- Can I override built-in Socialite providers like GitHub or Google?
- Absolutely. The manager allows you to override any default or third-party provider by registering a custom class that extends `SocialiteProviders\Manager\SocialiteProviders\AbstractProvider`. This is useful for adding custom logic or fixing deprecated endpoints.
- How does deferred instantiation improve performance in Laravel?
- Deferred instantiation loads providers only when Socialite is called, reducing memory usage and cold-start latency—critical for APIs or serverless environments like Vapor. This is especially beneficial for Lumen or high-traffic apps where eager loading would bloat memory.
- What Laravel versions are supported, and is there backward compatibility?
- The package supports Laravel 6 through 12 and Lumen. It follows SemVer, so minor updates include backward-compatible features. Always check the [release notes](https://github.com/SocialiteProviders/Manager/releases) for version-specific changes before upgrading.
- How do I dynamically override provider configurations at runtime?
- Use the `SocialiteProviders\Manager\SocialiteProviders\Manager::extend()` method or Laravel’s `config()` overrides. For example, you can load tenant-specific credentials from a database or cache during runtime, enabling multi-tenant or feature-flagged auth flows.
- Are there any security risks with runtime config overrides?
- Yes, runtime overrides can expose credentials if not handled carefully. Always validate and sanitize dynamic configs, and avoid hardcoding sensitive data. Use Laravel’s `config()` caching or environment-based overrides to mitigate risks.
- How do I handle OAuth1 providers like Twitter in this package?
- The package includes abstract base classes for both OAuth1 and OAuth2. For Twitter, use the `SocialiteProviders\Twitter\TwitterExtender` or create a custom provider extending `AbstractProvider`. Follow the [SocialiteProviders.com](https://socialiteproviders.com/) guide for OAuth1-specific setup.
- Can I use this package with serverless or edge deployments like AWS Lambda?
- Yes, the stateless mode (`stateless(true)`) is optimized for serverless. Ensure your providers support stateless flows (e.g., OAuth2 PKCE) and configure session drivers like Redis or database for token storage if needed.
- What’s the best way to test custom providers in this package?
- Use PHPUnit or Pest to mock the `Socialite` facade and test provider responses. The package integrates with Laravel’s testing helpers, so you can assert user data or errors. Example: `Socialite::shouldReceive('driver')->andReturn($mockProvider)->once();`