youshido/token-authenticator
youshido/token-authenticator adds token-based authentication to Laravel apps, letting you issue, validate, and revoke API tokens through a dedicated guard and middleware that plug into your existing user model and routes.
First, the framework reality check. Despite the assessment framing, youshido/token-authenticator (published as TokenAuthenticatorBundle) is a Symfony bundle, not a Laravel package. It will not install or boot inside a Laravel app. If your stack is Laravel, this package is a non-starter — you'd be reimplementing its ideas with Sanctum/Passport instead (see Gotchas). The guidance below assumes you're evaluating it for a Symfony codebase you maintain.
Minimal setup in a Symfony app:
composer require youshido/token-authenticatorconfig/bundles.php (Symfony 4+ flex style) or AppKernel.php (Symfony 3.x style).config/packages/security.yaml to use the bundle's token authenticator/guard for a stateless firewall, e.g. a dedicated api firewall with stateless: true and the bundle's authenticator listed under guard.authenticators (older Symfony) or custom_authenticators (newer).Where to look first: the bundle's DependencyInjection/Configuration.php and its README — this is a 2019-era, zero-star package with no dependents, so the README and the config tree are your only real documentation. Read the config tree before trusting the README; they drift in small packages.
First use case: protect a single JSON API endpoint. Issue a token at login, store it, then require Authorization: Bearer <token> (or whatever header/param the bundle expects — confirm in its config) on subsequent requests and let the guard resolve the user. Get one happy-path request working end-to-end before wiring anything else.
Stateless API firewall. The intended shape is a separate api firewall with stateless: true, no session, no form login, and the token authenticator as the only entry. Keep it isolated from your main firewall so web sessions and API tokens don't bleed into each other.
Token issuance flow. Typically: a login/credentials controller validates username+password, generates a token (random bytes, hashed before persistence), persists it against the user with an expiry, and returns the raw token once. Never store the raw token — store a hash and compare on lookup.
Token lookup + user resolution. The authenticator takes the incoming token, looks it up (by hash), checks expiry/revocation, and returns the associated user. Wire your user provider so the guard receives a proper UserInterface. If the bundle expects a specific token entity contract, implement it rather than fighting the guard.
Header vs. query param. Configure one canonical transport (header preferred) and reject the other to avoid tokens leaking into logs, referrers, and browser history.
Lifecycle hooks. Put expiry checks, revocation, "last used" timestamps, and rotation in the token repository/service layer, not scattered in controllers. A small TokenManager service wrapping create/validate/revoke keeps the guard thin and testable.
Testing. Unit-test the token manager (expiry, revocation, hashing) directly; use Symfony's KernelBrowser/functional tests for the firewall path. Because the package is unmaintained, your test suite is the only regression net you'll have.
AbstractAuthenticator/AuthenticatorInterface, or you're pinned to an old Symfony. This is the biggest practical blocker.composer.json.hash_equals) for tokens, hashed-at-rest storage, enforced expiry, revocation on password change, and rate limiting on the token endpoint. Small packages frequently omit some of these.bin/console debug:config <bundle_alias> and debug:container to confirm services and config actually loaded — misregistration is the most common silent failure. Enable the profiler's security panel to see which authenticator ran and why a request was rejected.AbstractAuthenticator (Symfony 6+) or switching to a maintained token package is usually a day or two of work. Factor that into any "should we keep this?" decision.How can I help you explore Laravel packages today?