Skip to content

chore: sync PHP client with Apify OpenAPI spec v2-2026-07-08T143931Z + compression/OS-token alignment#3

Merged
Pijukatel merged 2 commits into
masterfrom
claude/sharp-sagan-1w4ucz
Jul 10, 2026
Merged

chore: sync PHP client with Apify OpenAPI spec v2-2026-07-08T143931Z + compression/OS-token alignment#3
Pijukatel merged 2 commits into
masterfrom
claude/sharp-sagan-1w4ucz

Conversation

@Pijukatel

@Pijukatel Pijukatel commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Syncs the PHP client with Apify OpenAPI spec v2-2026-07-08T143931Z and aligns it with recent reference-client changes, then confirms two cross-client uniformity requirements. Version 0.2.0.

Changes

Spec sync

  • Bumped Version::API_SPEC_VERSION to v2-2026-07-08T143931Z. No in-scope endpoint/parameter/schema delta; coverage unchanged.

Request-body compression — both brotli and gzip (reference: apify-client-js#962)

  • The client prefers brotli (Content-Encoding: br) via the PECL brotli extension when loaded and falls back to gzip (gzencode, Content-Encoding: gzip) otherwise — both paths supported (PHP has no pure-language brotli encoder, so this is the idiomatic "both paths" design without a heavyweight hard dependency). Existing behavior preserved: only compress bodies ≥ 1024 bytes, compress once before the retry loop, skip when Content-Encoding is already set.
  • Test/CI hardening: refactored a testable compressWith seam and added deterministic unit tests for both codecs (gzip fallback, brotli preference, brotli-fails→gzip, real brotli round-trip, no-codec, size-gate). Added a dedicated unit-brotli CI job that installs the brotli extension and fails fast if it doesn't load, so the real br round-trip runs in CI while the main job covers the real gzip fallback.

User-Agent OS token — identical across all clients (reference: apify-client-js#964)

  • Platform::osToken(PHP_OS) maps WIN* → win32, CYGWIN* → cygwin, otherwise lowercase — exactly the reference JS os.platform() value for every PHP_OS (linux, darwin, freebsd, openbsd, netbsd, sunos, aix, win32, cygwin). Tests assert every emitted value.

Testing

  • php-cs-fixer clean; PHPStan level 6 in CI.
  • Unit 76 pass (+1 real-brotli test that runs in the unit-brotli CI job); integration 42/42 against the live API.

Note

The live spec has since advanced beyond this PR's baseline (v2-2026-07-08T143931Z); a re-sync to the newest version is a separate future change, not part of this compression/OS-token work.

claude added 2 commits July 10, 2026 09:54
- Bump API_SPEC_VERSION to v2-2026-07-08T143931Z and client version to 0.2.0
- Align User-Agent OS token with reference clients via Platform::osToken
  (WIN* -> win32, CYGWIN* -> cygwin, else lowercase PHP_OS)
- Add request-body compression for bodies >= 1024 bytes: brotli (Content-Encoding: br)
  when the PECL brotli extension is present, gzip (Content-Encoding: gzip) fallback
- Add zlib to CI setup-php extensions
… token

Split Compression size-gate + codec selection into a testable compressWith()
seam (no behavior change) so both the brotli path and the gzip fallback are
covered deterministically regardless of whether the PECL brotli extension is
loaded. Add a unit-brotli CI job so the real brotli round-trip runs in CI, and
guard the gzip tests to skip on zlib-less builds. Add an AIX->aix case
asserting the User-Agent OS token matches the reference JS os.platform() token.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xbC2QoA4QKyvhC1d7gYap
@Pijukatel Pijukatel force-pushed the claude/sharp-sagan-1w4ucz branch from 6829a55 to e5f86f4 Compare July 10, 2026 09:54
@Pijukatel Pijukatel changed the title chore: sync PHP client with Apify OpenAPI spec v2-2026-07-08T143931Z chore: sync PHP client with Apify OpenAPI spec v2-2026-07-08T143931Z + compression/OS-token alignment Jul 10, 2026
@Pijukatel Pijukatel merged commit ef5266c into master Jul 10, 2026
3 checks passed
@Pijukatel Pijukatel deleted the claude/sharp-sagan-1w4ucz branch July 10, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants