teapot/status-code
teapot/status-code gives Laravel and PHP apps a clean way to reference HTTP status codes. Replace magic numbers with readable constants and helpers in responses, middleware, and tests, keeping your API consistent and self-documenting, with a touch of teapot humor.
Architecture fit. teapot/status-code is a micro-utility, not a framework component: it encapsulates HTTP status codes (numeric value plus reason phrase) as PHP constants or enum cases. Architecturally it is a leaf dependency with no transitive surface — it does not touch routing, middleware, PSR-7 messages, or the HTTP kernel. That makes it a near-zero-friction fit for any Laravel codebase that currently passes raw integers (return response()->json($payload, 422)) or scatters magic numbers through controllers, form requests, and API resources. It is a readability and type-safety affordance, not a capability addition.
Integration feasibility. High. For a Laravel app the realistic integration points are: (1) controller and JsonResponse return paths, (2) custom exception handlers in bootstrap/app.php / Handler::render(), (3) API Resources and Responsable objects, and (4) test assertions. All of these accept an integer today, so adoption is additive and reversible — the enum/constant can be unwrapped at the boundary, meaning no architectural commitment is created. There is no service provider, no config publish, no migration, and no runtime hook. Composer install plus a lint rule is the entire onboarding cost.
Technical risk. Low but non-zero, concentrated in three areas:
Symfony\Component\HttpFoundation\Response::HTTP_* constants, and fig/http-message-util covers the PSR-7 world. Adopting a 45-star package for the same data creates a second vocabulary for the same concept — a genuine consistency risk in code review, not a runtime one.None of these are correctness risks. All are governance risks, and all are cheap to mitigate given the package's size.
Key questions for the maintainer/owner.
Stack fit. Compatible with any Laravel 9+ / PHP 8.1+ application (verify the exact floor). It has no opinion on Laravel version, no facade, and no container bindings, so it will not collide with framework upgrades. The only real decision is where the boundary sits: adopt it strictly in the HTTP/adapter layer (controllers, exception renderers, resources) and never let the enum leak into domain or service-layer signatures. That preserves the option to remove the dependency in an afternoon.
Migration path. Three sequenced, independently shippable steps:
Symfony Response::HTTP_* for the subset actually used. This catches reason-phrase drift and gives a mechanical removal trigger later.Compatibility and sequencing. No database, cache, queue, or config surface — so no deploy ordering constraints and no rollback ceremony beyond reverting a commit. The one sequencing rule: land the equivalence test (step 1) before any call-site changes, so a future package swap or abandonment is a one-line verification rather than an audit. If the team already standardizes on Symfony constants, the correct decision may be to not adopt and instead add a PHPStan/ Pint rule banning bare status integers — a strictly lower-risk path to the same outcome.
Maintenance. Negligible runtime footprint; no configuration, no migrations, no scheduled work. The real maintenance is version hygiene: a dependency-update bot plus the equivalence test is sufficient. Budget effectively zero engineering hours per quarter.
Support. No vendor relationship and no commercial backing. Support model is "read the source" — which is feasible here, since the package is small enough to audit in full before adoption. Recommend a 30-minute read-through of the tagged release as the acceptance gate rather than relying on the star count.
Scaling. Irrelevant in the horizontal sense — no I/O, no state, no allocation beyond enum/constant resolution. There is no performance consideration at any realistic request volume. The only "scale" concern is organizational: as headcount grows, divergent conventions (some code using Symfony constants, some using this package, some using ints) become a review-time tax. Codify the choice in the style guide or drop the dependency.
Failure modes. Ranked by likelihood:
Ramp-up. Effectively zero for any PHP developer — there is nothing to learn beyond the enum case names. Onboarding cost is a single line in the contributing guide. The decision cost dominates the implementation cost.
TPM recommendation. Approve as a low-stakes, reversible convenience dependency for application code, contingent on the equivalence test and a static-analysis rule pinning usage to one convention. Do not adopt it in shared internal libraries or packages, where the zero-dependent, single-maintainer profile is a poor trade against simply declaring the enum locally. If the team's existing Symfony-constant convention is already consistent, the higher-value move is enforcing that convention rather than adding a second vocabulary.
How can I help you explore Laravel packages today?