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 Server Bearer Token Laravel Package

spomky-labs/oauth2-server-bearer-token

Adds RFC 6750 Bearer Token support to the Spomky-Labs OAuth2 Server for PHP, enabling standard OAuth2 bearer token handling for authorization and protected API resource requests.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

What this package actually is. spomky-labs/oauth2-server-bearer-token is not a standalone OAuth2 server and not a Laravel package. It is a narrow extension to spomky-labs/oauth2-server (part of the Spomky-Labs OAuth2 Framework family) that contributes RFC 6750 bearer-token handling — token type registration, Authorization: Bearer parsing, and the associated error responses (invalid_token, insufficient_scope, WWW-Authenticate challenge headers). Its value is entirely contingent on already running the parent server. On its own it does nothing.

Architecture fit. The parent library is a PSR-7/PSR-15-oriented, framework-agnostic authorization server. It composes grant types, token repositories, and middleware through dependency injection, with no Laravel service provider, facade, config publishing, migrations, or Eloquent bindings. That is a real mismatch with a Laravel codebase: adopting this means hand-wiring the entire server pipeline into the container, adapting Laravel's request/response cycle to PSR-7, and implementing storage contracts (client, access token, refresh token, scope) from scratch. The bearer-token package is a small fraction of that total integration cost — likely under 5% of the effort.

Integration feasibility. Technically possible, practically unattractive. The main friction points are:

  • No Laravel glue whatsoever. Every binding, middleware registration, and exception-to-JSON mapping is bespoke work.
  • PSR-7 version pinning. Spomky-Labs packages of this vintage generally target PSR-7 v1 interfaces (psr/http-message ^1.0) and older zend-diactoros/nyholm/psr7 releases. Modern Laravel stacks have moved to PSR-7 v2 and PHP 8.2+. A composer update at the framework level is likely to produce conflicts.
  • PHP version ceiling. The package was released into an ecosystem that was still largely PHP 7.x. Verify composer.json require constraints before any commitment — this is the single most likely hard blocker.

Technical risk. This is the section that should stop the discussion. The metrics (0 score, no stars, 0 dependents) are not merely a popularity signal in isolation — for authentication code they are a governance signal:

  • Zero known consumers means zero incidental testing. No one is filing issues that would surface a regression.
  • Unmaintained dependency in the auth boundary. A defect here is a token-forgery or token-leak defect. There is no evidence of a security policy, coordinated disclosure process, or active maintainer.
  • Composer ecosystem atrophy. Abandoned packages become transitive-constraint anchors; they force --ignore-platform-reqs and eventually block framework upgrades.
  • Redundant with the parent. The parent server already handles bearer tokens. The most likely explanation for this package's existence is historical decomposition, and the most likely outcome is that its functionality has been inlined or superseded upstream.

Key questions to resolve before proceeding.

  1. Is spomky-labs/oauth2-server itself still maintained, and what is its current release cadence and PHP constraint?
  2. What does this package add that the parent's own token-type handling does not?
  3. What are the exact require constraints (PHP, PSR-7, parent version)?
  4. Is there a tagged release compatible with our PHP and Laravel versions, or would we be installing a dev branch?
  5. Who maintains it, and what is the security disclosure path?
  6. Is there a documented successor? (The mainstream answer in the PHP ecosystem is league/oauth2-server, and in Laravel specifically laravel/passport.)

Integration Approach

Stack fit. Poor as a direct fit, and the framing of "Laravel/PHP package" should be corrected internally: it is a PHP package that happens to be installable by Composer into a Laravel project. Laravel's own OAuth2 story is laravel/passport (built on league/oauth2-server), which ships migrations, guards, scopes, artisan commands, and a supported upgrade path. Any evaluation of this package has to justify why that is being rejected — and there is no apparent reason it would be.

Recommended path (greenfield or upgradeable). Do not adopt. Use laravel/passport for first-party OAuth2, or league/oauth2-server directly if we need framework independence. Both have active maintenance, security advisories, and a decade of production use. If the requirement is machine-to-machine tokens only, Laravel Sanctum is a lighter option that avoids the full authorization-server surface.

Contingency path (already committed to Spomky-Labs). If a legacy service already runs the Spomky server, this package is a reasonable way to keep bearer-token behavior consistent rather than hand-rolling it. In that case:

  1. Pin exactly — commit the resolved version and lock file; treat it as a vendored artifact.
  2. Wrap it behind our own TokenAuthenticator interface so the dependency is confined to one adapter class.
  3. Fork to a private registry (Satis or a private Composer repo) so an upstream deletion or force-push cannot break builds.
  4. Write contract tests covering WWW-Authenticate headers, malformed-header handling, expired tokens, and scope insufficiency — these are the behaviors we would otherwise inherit untested.

Migration path off the parent stack. The exit cost is low precisely because the package is small: its surface is token-type registration and header parsing, on the order of a few hundred lines. Reimplementing equivalent behavior on league/oauth2-server is a contained piece of work, but the storage contracts and grant-type wiring around it are not — that is the real migration. Budget the migration at the server level, not the bearer-token level.

Compatibility and sequencing.

  1. Spike (1 week). Install in a throwaway Laravel app; confirm PHP/PSR-7 constraints resolve and that the parent server boots under Laravel's container. This is a go/no-go gate, and the expectation is no-go.
  2. Threat model (parallel). Write down what a bearer-token failure costs us. Auth code should not be the place we accept unmaintained dependencies.
  3. Decide (week 2). Default recommendation is to close the evaluation and standardize on Passport or Sanctum.
  4. If proceeding anyway: vendor, wrap, test, and add a calendar reminder to reassess at each PHP minor upgrade.

Operational Impact

Maintenance. Effectively unbudgeted. With no maintainer activity and no consumers, we are the maintainers — any bug fix is a fork. Realistic ongoing cost is small in lines of code but non-zero in attention: someone must monitor PHP releases, PSR interface bumps, and the parent server's status, and translate those into a private patch. Compare against Passport, where that work is externalized to an active community.

Support. There is no support channel to escalate to: no issue triage, no documentation beyond what the parent project offers, no Stack Overflow corpus for this specific package. On-call engineers debugging a 401 in production will be reading source. That is an acceptable trade for a well-known library and a poor one for a package with zero dependents.

Scaling. Functionally this is the least concerning dimension. Bearer-token validation is stateless header parsing plus a token-store lookup; the package itself adds negligible CPU. Scale characteristics are determined by the token repository (database or cache), not by this code. The scaling risk is organizational, not technical: as the service grows, the constraint-anchor effect of an old PSR-7 dependency compounds, and the eventual forced migration happens under pressure rather than on our schedule.

Failure modes to plan for.

  • Composer resolution failure on a PHP or framework upgrade — build-breaking, and the fix is a fork, not a version bump.
  • Upstream disappearance — repository archived or deleted; mitigated only by vendoring.
  • Silent behavioral gap — an unhandled Authorization header edge case (multiple spaces, case sensitivity, malformed token) producing an incorrect 401/403 or, worse, permissive validation. Contract tests are the mitigation.
  • Security advisory blind spot — no CVE feed covers this package, so a disclosure would reach us via the parent project or not at all.
  • Knowledge concentration — one engineer understands the Spomky wiring; document the adapter or accept bus-factor risk.

Ramp-up. Higher than the package size suggests. An engineer must learn the Spomky OAuth2 Framework's composition model (grant types, token type registration, PSR-15 middleware ordering) rather than Laravel idioms they already know. Estimate 2–3 sprints to first production token issuance if building the full server integration, versus roughly one sprint for Passport with substantially less bespoke code. The bearer-token package itself is a few hours of reading; the surrounding server is the cost.

Bottom line. The technical merit of the code is not in question — it is a small, focused piece of a coherent framework. The problem is the operating context: unmaintained, unused, outside our framework's idioms, and sitting directly on the authentication boundary. Recommend closing the evaluation and standardizing on laravel/passport (full OAuth2) or laravel/sanctum (first-party tokens), retaining this package only as a documented contingency for any pre-existing Spomky-Labs deployment.

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.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource