Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Oauth2 Client Bundle Laravel Package

jdelaune/oauth2-client-bundle

Symfony bundle that wraps the PHP League OAuth2 client, letting you configure OAuth2 providers as services and use them to run authorization flows and retrieve access tokens in your application. A lightweight way to wire OAuth2 clients into Symfony.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit — poor (primary blocker). This is a Symfony bundle, not a Laravel package. It ships the classic Symfony packaging triple — a Bundle class, a DependencyInjection\Extension with a Configuration tree, and compiler passes — none of which Laravel's container or bootstrap lifecycle understands. Laravel consumes Symfony components (HttpFoundation, Routing, Console, EventDispatcher) but does not consume Symfony bundles. There is no bundles.php, no kernel bundle registration, no services.yaml autoloading. So the install path is not "composer require and go"; it is "read the bundle's ~few hundred lines of glue and rewrite them as a service provider."

What is actually reusable. The bundle is a thin wrapper. The substance underneath is league/oauth2-client plus provider-specific packages (league/oauth2-google, thenetworg/oauth2-azure, etc.), and those are framework-agnostic, actively maintained, and widely deployed. The genuinely valuable asset here is the pattern (a client factory keyed by provider name, a registry/container binding, config-driven provider resolution), not the code.

Integration feasibility — feasible but reimplementation, not integration. Effort is small: a config file (config/oauth2.php), a singleton factory binding, a token repository, a callback controller, and a provider resolver. Realistic sizing is 2–4 engineering days including tests, assuming the underlying league providers cover the target IdPs. The bundle itself is a 2019-era Symfony 2–4 artifact; its composer.json constraints and any Symfony DI/Config API usage will not resolve against a modern Laravel app's dependency graph without forking and patching.

Technical risk — medium-high, concentrated in provenance rather than code.

  • Last release 2019-12-17; Symfony 4 reached end of life in November 2023, so the declared support envelope is entirely EOL.
  • 5 stars, 0 dependents: no downstream usage to surface regressions, no issue triage, no security response channel. A CVE in the wrapper would go unpatched indefinitely.
  • PHP 8.x compatibility is unverified — typed properties, dynamic property deprecations, and return-type changes in the Symfony components it touches are plausible failure points.
  • MIT license means forking is legally clean, which is the only real mitigation.

Key questions before any build decision.

  1. Is the requirement "log in with an external IdP" (then Laravel Socialite is the idiomatic answer) or "call third-party APIs on behalf of a user, with refresh" (then league/oauth2-client directly, no bundle)?
  2. Which grants and which providers? Authorization Code + PKCE only, or client credentials and refresh token rotation as well?
  3. Where do tokens live — session, encrypted per-user columns, or an external secret store — and what is the revocation story?
  4. Are multiple providers concurrent, or one per environment? This determines whether a registry abstraction is warranted or a single config entry suffices.
  5. Who owns the fork if we vendor it, and what is the review cadence for the league/* dependency chain?

Recommendation: treat this package as reference material, not a dependency. The 0.245 score is consistent with what the metadata shows — unmaintained, framework-mismatched, zero adoption.

Integration Approach

Stack fit — no direct fit; consume the abstraction, drop the wrapper. A Laravel application already has everything the bundle provides: configuration via config/, singletons via the service container, HTTP via Illuminate\Http\Client, session/state via the session store, and routing via the router. The bundle's contribution collapses to a factory + registry, roughly 100–200 lines of Laravel-native code.

Migration path.

  1. Inventory the providers and grants currently expected (from the consuming app's config, not from the bundle).
  2. Replace the bundle dependency with league/oauth2-client ^2.7 plus the specific provider packages. Pin minor versions and record them.
  3. Implement Oauth2ClientFactory as a container singleton resolving provider name → configured AbstractProvider, driven by config/oauth2.php with env-backed client_id/client_secret/redirect_uri.
  4. Add a TokenStore contract with a database-backed implementation; encrypt access/refresh tokens at rest using Laravel's encrypted cast.
  5. Add the callback route + controller with explicit state validation (and PKCE where the provider supports it).
  6. If a guard-style login is needed, wrap step 5 in a Guard/UserProvider rather than bolting auth onto the controller.

Compatibility. Verify PHP floor against the target runtime; league/oauth2-client v2 supports PHP 7.2+ and runs on 8.x, but the bundle's own constraints will conflict. Do not attempt to keep the bundle in the tree alongside Laravel — the DI extension will either never execute (dead code) or, worse, get autoloaded and fail on missing Symfony Kernel classes.

Sequencing. Spike the chosen provider end-to-end first (half a day, real credentials, real callback) to confirm scopes, redirect URI registration, and token response shape before building the abstraction. Then generalize to the registry, then add persistence, then tests, then cutover. Do not build a multi-provider abstraction on a single unvalidated provider.

Operational Impact

Maintenance — the dominant cost, and it is structural. With no upstream releases since 2019 and zero dependents, there is no maintenance tail to ride. Any fork becomes a first-class owned artifact requiring dependency-bump PRs and a security watch on league/oauth2-client and its provider packages. The Laravel-native rewrite avoids this entirely: league/oauth2-client has an active maintainer base and predictable release cadence.

Support. No vendor, no SLA, no community. Documentation is a README and the Symfony docs for a framework the target stack does not use. On-call runbooks must be written from scratch. Budget a named owner for the OAuth surface regardless of path chosen — this is auth-adjacent code and should not be orphaned.

Scaling. Token acquisition is outbound HTTP to the IdP, so the IdP's rate limits, not application capacity, govern throughput. Two things to design in early: (a) cache provider metadata/discovery documents rather than fetching per request; (b) serialize refresh per user to avoid concurrent refresh storms invalidating rotating refresh tokens. Session-backed token storage will not scale across horizontally scaled instances without a shared session store.

Failure modes to plan for.

  • Expired or revoked refresh token → needs a clean re-auth redirect, not a 500.
  • IdP outage → circuit-break and degrade; do not block unrelated request paths.
  • Redirect URI mismatch on environment promotion → a config-drift class of bug that must be caught at deploy, not at first login.
  • State/nonce mismatch or missing PKCE → CSRF exposure; validate strictly and fail closed.
  • Token leakage into logs and error trackers via Http:: request dumps or exception payloads — scrub explicitly.
  • Session bloat from large JWT/ID-token payloads.

Ramp-up. Low. The rewritten surface is small and idiomatic Laravel, so a mid-level engineer can own it within a sprint. The bundle itself has a steeper read cost precisely because Symfony DI extension and compiler-pass idioms are unfamiliar to most Laravel developers — an argument against inheriting it even if the code were current.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log