Migrate to mapper 3.0.0 and extend the HTTP client and server.#59
Merged
Conversation
Replace the local path repository with the published 3.0.0 release and adopt its renamed API (Serializable, Mappable, IterableMappable, ElementType). Bump guzzlehttp/guzzle and phpstan/phpstan in the same dependency pass.
- Add HttpBuilder::withDefaultHeaders, merged under per-request headers. - Add typed header, query, and raw-body accessors on server requests. - Add Code timeout predicates and ContentType media-type accessors.
There was a problem hiding this comment.
Pull request overview
This pull request updates the library to work with tiny-blocks/mapper 3.x and expands the HTTP surface with additional typed helpers for both server-side request handling and client-side request/response ergonomics.
Changes:
- Migrate mapper integration from
Mapper/*MapperAPIs to the newSerializable/MappableAPIs. - Extend server request decoding with query/header/raw-body access and add route-attribute selection via
Uri::only(...). - Extend client ergonomics with default headers support,
Response::orFail(), RFC 8288Linkheaders, andContentTypehelpers.
Reviewed changes
Copilot reviewed 64 out of 65 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/Server/ResponseTest.php | Update mapper wording in test. |
| tests/Unit/Server/RequestTest.php | Add tests for query/headers/raw body and Uri::only. |
| tests/Unit/LinkTest.php | Add tests for RFC 8288 Link header. |
| tests/Unit/HttpTest.php | Add tests for default header precedence. |
| tests/Unit/HttpBuilderTest.php | Add tests for builder immutability and default headers. |
| tests/Unit/HeadersTest.php | Add tests for Headers::attribute. |
| tests/Unit/CookieTest.php | Refine BDD annotations and immutability assertion. |
| tests/Unit/ContentTypeTest.php | Add tests for ContentType::toString() and mimeType(). |
| tests/Unit/CodeTest.php | Add tests for tryFromNullable and isTimeout. |
| tests/Unit/Client/ResponseTest.php | Add tests for Response::orFail(). |
| tests/Models/Products.php | Migrate iterable model to mapper v3 APIs. |
| tests/Models/Product.php | Migrate object model to Mappable. |
| tests/Models/Order.php | Migrate object model to Mappable. |
| src/Server/Request.php | Add query/header/headers/rawBody helpers. |
| src/Server/Decoded/Uri.php | Add only(keys: ...) route extraction. |
| src/LinkRelation.php | Add link-relation enum. |
| src/Link.php | Add RFC 8288 Link header value object. |
| src/Internal/Server/Stream/StreamFactory.php | Switch body serialization to Serializable. |
| src/Internal/Client/RequestResolver.php | Add default headers merging before JSON defaults. |
| src/HttpBuilder.php | Add default headers support to builder. |
| src/Http.php | Add optional default headers to Http::with(...). |
| src/Headers.php | Simplify canonical header replacement and add attribute(). |
| src/Exceptions/LinkUriIsInvalid.php | Add exception for invalid Link URIs. |
| src/Exceptions/HttpResponseUnsuccessful.php | Add exception used by Response::orFail(). |
| src/Exceptions/BodyTypeIsUnsupported.php | Update wording to Serializable. |
| src/ContentType.php | Add toString(), mimeType(), and fix toArray(). |
| src/Code.php | Add tryFromNullable() and isTimeout(). |
| src/Client/Transports/NetworkTransport.php | Minor PSR-17 call cleanup. |
| src/Client/Response.php | Add orFail() helper. |
| README.md | Document new APIs: only, raw body, pagination links, default headers, orFail, ContentType. |
| composer.json | Bump mapper to ^3.0 and update dev deps. |
| CLAUDE.md | Add repo conventions index at root. |
| .gitignore | Ignore local PHPStan/Infection overrides and Claude local settings. |
| .github/workflows/ci.yml | Adjust concurrency group prefix. |
| .github/copilot-instructions.md | Point mandatory step to root CLAUDE.md. |
| .gitattributes | Align export-ignore list with repo contents. |
| .claude/skills/tiny-blocks-create/SKILL.md | Add/refresh scaffolding skill docs. |
| .claude/skills/tiny-blocks-create/assets/github/workflows/ci.yml | Add canonical CI asset. |
| .claude/skills/tiny-blocks-create/assets/github/PULL_REQUEST_TEMPLATE.md | Add canonical PR template asset. |
| .claude/skills/tiny-blocks-create/assets/github/ISSUE_TEMPLATE/feature_request.md | Add canonical feature template asset. |
| .claude/skills/tiny-blocks-create/assets/github/ISSUE_TEMPLATE/bug_report.md | Add canonical bug template asset. |
| .claude/skills/tiny-blocks-create/assets/docs/SECURITY.md | Add canonical security policy asset. |
| .claude/skills/tiny-blocks-create/assets/config/phpunit.xml | Add canonical PHPUnit config asset. |
| .claude/skills/tiny-blocks-create/assets/config/phpstan.neon.dist | Add canonical PHPStan config asset. |
| .claude/skills/tiny-blocks-create/assets/config/phpcs.xml | Add canonical PHPCS config asset. |
| .claude/skills/tiny-blocks-create/assets/config/Makefile | Add canonical Makefile asset. |
| .claude/skills/tiny-blocks-create/assets/config/infection.json.dist | Add canonical Infection config asset. |
| .claude/skills/tiny-blocks-create/assets/config/composer.json | Add canonical composer.json asset. |
| .claude/skills/tiny-blocks-create/assets/config/.gitignore | Add canonical gitignore asset. |
| .claude/skills/tiny-blocks-create/assets/config/.gitattributes | Add canonical gitattributes asset. |
| .claude/skills/tiny-blocks-create/assets/config/.editorconfig | Add canonical editorconfig asset. |
| .claude/skills/tiny-blocks-consume/SKILL.md | Add dependency discovery/reuse skill. |
| .claude/skills/tiny-blocks-consume/scripts/refresh-catalog.py | Add Packagist catalog refresh script. |
| .claude/skills/tiny-blocks-consume/references/catalog.md | Add generated tiny-blocks catalog. |
| .claude/skills/commit-message/SKILL.md | Move commit-message guidance into a skill. |
| .claude/settings.json | Add Claude settings baseline. |
| .claude/rules/php-library-tooling.md | Update tooling invariants documentation. |
| .claude/rules/php-library-testing.md | Tighten/clarify testing conventions. |
| .claude/rules/php-library-modeling.md | Clarify modeling rules and enum guidance. |
| .claude/rules/php-library-github-workflows.md | Update workflow conventions and invariants. |
| .claude/rules/php-library-documentation.md | Narrow scope to README/docs and required files. |
| .claude/rules/php-library-architecture.md | Clarify drivers test location conventions. |
| .claude/rules/php-library-code-style.md | Expand formatting/code-style rules. |
| .claude/rules/php-library-commits.md | Remove (superseded by commit-message skill). |
| .claude/CLAUDE.md | Remove (replaced by root CLAUDE.md). |
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.
Summary
What this pull request does.
Related issue
Closes #...
Checklist
composer reviewpasses.composer testspasses.