Repository navigation
Refresh: Laravel 13 and api-toolbox - #2
Merged
Merged
Conversation
Laravel 13.30 is the floor api-toolbox needs. Scribe moves to 5.11 for Laravel 13 support, larastan comes off 3.x-dev now a stable release covers it, and minimum-stability goes back to stable. The package is renamed from laravel/laravel to juststeveking/kit.
…est ids Every API error is now RFC 9457 problem details typed from the apiguide.dev catalogue. Kit's own messages stay translated: they are mapped onto the exceptions api-toolbox renders and arrive as the problem's detail. The exception callbacks keep only the security audit log. Kit's hand-rolled middleware gives way to the package: - IdempotencyKey becomes `idempotent`, with locking for in-flight retries; a reused key with a different payload is now 422, and the Idempotency-Replayed header is gone, as the draft defines none. - Sunset becomes #[Deprecation] and #[Sunset] on the controller. RetireSunsetEndpoints keeps kit's 410 after the sunset date, reading the same attributes. - AttachRequestId becomes Negotiation request IDs (UUIDv7) with W3C trace context, and problems carry the ID as their instance. - EnsureJsonApiRequest becomes `consumes:application/json`; its security headers move to AddSecurityHeaders. Guests are no longer redirected to a login route that does not exist, which forcing Accept: application/json used to hide.
JSON:API resources give way to plain Laravel resources, so success and error responses tell one story: application/json for data, RFC 9457 problem details for errors. - GET /v1/auth/tokens is cursor paginated through api-toolbox, with navigation in RFC 8288 Link headers and a 400 for a cursor that cannot be decoded. The body is the page of tokens. - GET /v1/auth/me sends an ETag and answers If-None-Match with 304. - Documented error examples are problem details, and a Scribe generator labels them application/problem+json. The contract test now checks each runtime response's media type against the spec as well as its body.
PHPStan at level 10 reported 72 errors that CI never ran. They are fixed with typed reads (Arr::string, config()->string(), typed model properties) rather than casts from mixed, and CI now runs Pint and PHPStan before the tests. The payloads' fromReqest is renamed fromRequest. Two errors are ignored in place with the reason: CursorPage::of() in api-toolbox types its paginator too narrowly to accept int keys, and Sanctum types currentAccessToken() as never being a TransientToken.
boost:update with api-toolbox opted in under "packages", so agents get its guideline and the api-toolbox-development skill. Boost's own skills move to their current set (testing-best-practices replaces pest-testing). Cloud is set off explicitly: Boost treats a missing key as on and installs a Laravel Cloud deployment skill.
The README described JSON:API resources, the Sunset middleware and Laravel 12. It now covers problem details and how localization applies to them, idempotency, deprecation attributes, pagination, ETags and the API catalog, and lists the token endpoints it was missing. A test covers the API catalog the README points clients at, and the user factory sets a ULID so Scribe's examples document a real id rather than a nullable one.
|
Important Review skippedToo many files! This PR contains 130 files, which is 30 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configuration
⛔ Files ignored due to path filters: 1
📒 Files selected for processing: 130
You can disable this status message by setting the
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Composer's post-autoload-dump boots the app, which with no .env runs as production and fails ProductionSecurityChecks. ci-tests has failed on main for this reason since the checks landed. Gitleaks reads two Idempotency-Key fixtures in IdempotencyKeyTest as generic API keys; their fingerprints go in .gitleaksignore.
Boost 2.10 no longer writes Gemini guidance, so GEMINI.md and .gemini/settings.json were stuck describing Laravel 12. Gemini comes out of boost.json's agents so a reinstall does not bring them back.
api-toolbox 0.3.0 reads the details of the problems it raises through the translator, so Kit adds Spanish for every one of them in lang/vendor/api-toolbox/es. The idempotency conflict and 415 tests assert the Spanish detail again, and a test fails if a package upgrade adds a line the Spanish file lacks. 0.3.0 also types CursorPage over the paginator's key and value, so the PHPStan ignore in ListTokensController goes.
composer audit only knows published advisories, so a freshly compromised release passes it and the dependency bot would open a PR for it. Laravel Vet closes that gap as a Composer plugin: - vet.json records what has been read; composer install fails on anything else, including a version re-published with other files. - minimum-release-age holds back every release younger than 7 days. juststeveking/* and roave/security-advisories are excluded: the first are first-party, the second has to be current to protect anything. The baseline is today's lock moved back to releases at least a week old, which is why fourteen packages step down a patch or minor (laravel/framework 13.37.0 to 13.35.0, guzzle 8.3.0 to 8.2.0). The dependency bot moves to weekly. Vet refuses the update it writes, so the workflow tolerates that, installs the new lock without the plugin, and puts Vet's report in the PR body. The PR passes CI once vet.json is updated on its branch.
Audit dependencies with Laravel Vet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings Kit up to Laravel 13 and moves its HTTP plumbing onto api-toolbox, which needs Laravel 13.30+.
What changes for API clients
application/problem+json), typed from the apiguide.dev catalogue. Clients branch ontype;detailcarries the message, still translated viaAccept-Languagewhere Kit raised it.instanceis the request ID.{"data": {...}}with attributes at the top level.GET /v1/auth/tokensis cursor paginated: the body is the page of tokens, navigation is inLinkheaders, andmeta.countis gone.GET /v1/auth/mesends anETagand answersIf-None-Matchwith 304.Idempotency-Replayedis gone.#[Deprecation]/#[Sunset]on the controller instead of thesunset:middleware string; past the sunset date the endpoint is a 410 problem.consumes:application/jsonand carries anAcceptheader naming the supported type./.well-known/api-catalogadvertises/v1with its OpenAPI description.Under the hood
IdempotencyKey,Sunset,AttachRequestIdandEnsureJsonApiRequestare removed in favour of the package. The security headers move toAddSecurityHeaders; the 410 after sunset stays in Kit asRetireSunsetEndpoints, reading the same attributes.bootstrap/app.phpnow only write the security audit log;map()swaps in translated messages.loginroute. ForcingAccept: application/jsonused to hide this; without it, a request with noAcceptheader was a 500.application/problem+json, and the contract test now checks each response's media type against the spec, not only its body.composer.jsonis renamed fromlaravel/laraveltojuststeveking/kit, larastan comes off3.x-dev, and minimum-stability is back to stable.Follow-ups landed in this PR
lang/vendor/api-toolbox/es/problems.php, with a test that fails if a package upgrade adds a line the Spanish file lacks.CursorPagegenerically, so the PHPStan ignore inListTokensControlleris gone.GEMINI.mdand.gemini/are removed: Boost 2.10 no longer writes Gemini guidance..envbeforecomposer install(the cause ofci-testsfailing onmainsince February), and.gitleaksignorecovers two Idempotency-Key test fixtures.85 tests pass;
composer lintandcomposer stanare clean.