PHP Api improvements - #8
Merged
Merged
Conversation
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.
What changed?
Fetch::macro()support using Laravel’sMacroabletrait.baseUrl()support for requests and downloads.when()andunless()support throughConditionable.FetchResponse, includingcreated(),notFound(),unauthorized(),unprocessableEntity(),statusIs(), and others.FetchRequestStartedFetchRequestCompletedFetchRequestFailed#[On(...)]event handling and payloads.Why?
These changes improve the PHP API’s ergonomics and extensibility while staying consistent with familiar Laravel conventions.
Application-wide listeners can now observe the main request lifecycle without replacing or changing existing NativePHP component listeners. The implementation uses NativePHP’s existing
BroadcastsGloballymechanism, avoiding additional callback infrastructure or changes to the native bridge.How was it tested?
The following automated checks passed:
composer testcomposer format:checkcomposer analysecomposer validate --strictnpm test --prefix resources/jsnpm run syntax --prefix resources/jsnpm run format:check --prefix resources/jsnpm run docs:build --prefix docsgit diff --checkTests also verify that:
#[On(...)]component listeners continue receiving the same events.Platforms tested
Breaking changes?
None.
All existing public APIs, event names, constructors, payloads, request IDs, bridge calls, and NativeComponent
#[On(...)]signatures remain compatible.Checklist