Skip to content

chore: Migrate to JanePHP 8.0 and switch the HTTP stack to Symfony HttpClient - #193

Open
Korbeil wants to merge 3 commits into
mainfrom
jane-8
Open

Korbeil wants to merge 3 commits into
mainfrom
jane-8

Conversation

@Korbeil

@Korbeil Korbeil commented Oct 2, 2026 •

Copy link
Copy Markdown
Member
Q A
Branch? jane-8
New feature? no
BC break? yes
Upgrade JanePHP? 8.0.0

Description

Migrate the generated client to JanePHP 8.0.0 (released Oct 1, 2026) and configure the new default-fetch-mode generation option to preload.

Main changes coming with JanePHP 8

  • Generated models expose public natively typed properties instead of getXxx() / setXxx() accessors, so the public API is now $user->name instead of $user->getName() (see the JanePHP 8.0.0 migration table);
  • The HTTP layer is now built on Symfony\Contracts\HttpClient\HttpClientInterface instead of PSR-7 / PSR-18 / HTTPlug — removed the php-http/*, psr/* and nyholm/psr7 dependencies, added symfony/http-client ^6.4 || ^7.0 || ^8.0;
  • Endpoints keep no-throw semantics on HTTP responses (getHeaders(false) / getContent(false)): documented statuses are mapped as before and undocumented ones now throw UnexpectedStatusCodeException (new upstream default throw-unexpected-status-code: true);
  • The $fetch trailing parameter / FETCH_OBJECT / FETCH_RESPONSE constants of generated endpoints & clients are gone; raw responses stay available with executeRawEndpoint().

Fetch mode

  • All GET / HEAD operations are generated with the preload fetch mode via 'default-fetch-mode' => 'preload' in the Jane configuration file.
  • Slack responses always map to a ...Response200 and a ...Responsedefault fallback model, so for this specification the deferred modes degrade to the same blocking runtime behavior as before (lazy ghost proxies additionally require PHP >= 8.4 and a single-model response, see JanePHP ADR 0014). The option sets the stage for future per-operation x-fetch-mode tweaks in the patched specification.

Custom code rework

  • src/HttpPlugin/* (HTTPlug plugins) removed, replaced by src/Http/* Symfony HttpClient decorator factories:
    • JoliCode\Slack\Http\SlackAuthentication implements the new JanePHP AuthenticationPlugin (decorate() + getScope()) and is wired through AuthenticationRegistry: it adds Authorization: Bearer ... to the endpoints declaring the slackAuth scope;
    • JoliCode\Slack\Http\SlackErrorHttpClient intercepts Slack {"ok": false} payloads (a 2xx HTTP status carrying an error) and throws the historical JoliCode\Slack\Exception\SlackErrorResponse with the error code and response metadata — the check runs lazily, on first content read, keeping it compatible with the deferred fetch modes;
  • Host & base path rewriting (https://slack.com/api) is now handled by the generated code through JanePHP's ServerUrlHttpClient decorator (absolute URLs, e.g. file uploads on https://files.slack.com, are forwarded untouched), so the historical applyServerPlugins: false workaround is gone;
  • ClientFactory::create(string $token, ?HttpClientInterface $httpClient = null) now expects a Symfony\Contracts\HttpClient\HttpClientInterface, falling back to Symfony\Component\HttpClient\HttpClient::create();
  • filesUploadV2() upload step reworked on HttpClientInterface::request() with string|resource bodies, and filesize() to determine the file size;
  • filesUpload() override signature updated (the $fetch parameter is gone upstream);
  • Tests updated to the new property access (and fopen() / filesize() / curl instead of the Nyholm streams).

Checklist

  • generated/ rebuilt with JanePHP 8.0.0 (the check-spec job diff-checks generation determinism)
  • ApiTest (real Slack API) & offline tests pass
  • Coding standards checks pass (repository .php-cs-fixer.php, also run by the generation)

* composer: jane-php/open-api-runtime & jane-php/open-api-2 ^8.0, symfony/http-client ^6.4|^7.0|^8.0; drop psr/*, php-http/*, nyholm/psr7
* .jane-openapi.php: default-fetch-mode => preload; generated/ rebuilt with JanePHP 8.0 (public typed model properties, no $fetch param, getFetchMode()/getTargetClass())
* src: HTTPlug plugins replaced by Symfony HttpClient decorators (SlackAuthentication + AuthenticationRegistry, SlackErrorHttpClient preserving SlackErrorResponse on {"ok": false} payloads); serve URL handled by Jane's ServerUrlHttpClient
* ClientFactory::create() expects a Symfony Contracts HttpClientInterface; iterate()/filesUploadV2() reworked accordingly; guards for uninitialized typed properties
* CI: test matrix on PHP 8.4/8.5 with prefer-lowest on 8.4 (deprecations helper disabled), setup-php for the check-spec job
* docs: quick-start, usage & changelog (5.0.0) updated

@damienalexandre damienalexandre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of the gettter/setter to property change.

Anyway it will require a new major version 👍

Comment thread README.md Outdated
Korbeil and others added 2 commits October 5, 2026 12:42
JanePHP 8 generates models with public natively typed properties instead
of getters, like the rest of the documentation already shows.

Co-authored-by: damienalexandre <damienalexandre@users.noreply.github.com>
The model-sample image showed a User dump from 2021 with the old protected
property access. Take a new dump of ObjsUser matching the JanePHP 8 API, in
which properties are public and natively typed.

This branch has not been deployed

No deployments
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.

2 participants