Rewrite for PHP 8.3, add Firestore support - #7
Merged
Merged
Conversation
Filtering and ordering are one field only here, so anything else throws instead of quietly answering a different question.
google/cloud-firestore needs ext-grpc, which a library can't ask for. Plain HTTP works fine and runs anywhere.
Resolution has to happen on the way to the wire, and I kept forgetting it on new write paths, so it's a type you can't build without resolving.
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.
Version 0.4 has not been installable for years. It required PHP 5.6 and Guzzle 6,
authenticated with a database secret in the query string, and called
GuzzleHttp\Psr7\stream_for(), which was removed in guzzle/psr7 2.0. A freshcomposer requirecould not boot. One repository also passedverify => false,disabling TLS certificate verification.
This rewrites it for PHP 8.3+ and keeps the part that was worth keeping.
What changed
The bundled HTTP client is gone. It was never the valuable part, and
kreait/firebase-phpdoes transport and credentials properly. What stays is theentity and repository layer, rebuilt on top of a small
Connectionport.Two adapters ship:
kreait/firebase-phpext-grpc, so it runs on shared hostingThe entity layer knows nothing about Firebase, so the same entities,
repositories and queries run against either.
Notable
value objects. Reading goes through
cuyz/valinor; writing does not, becauseprivate properties and nulls have to stay out of the payload.
modify()andtransaction(). Verified with realparallel processes rather than a mock: 4 writers, 20 increments, no lost
updates on either backend.
Sentinel::ServerTimestampandSentinel::Remove.UnsupportedQueryinstead ofquietly answering a different question.
Breaking
Everything.
PhpFirebase\Firebase, the Guzzle client and theextra/autoloadpath are removed, namespaces moved, and repositories now take a
Connection.See UPGRADING.md.
Realtime Database users need to require
kreait/firebase-phpexplicitly - it isnot a hard dependency, since Firestore users do not need it.
Not included
Streaming. RTDB can push changes over
text/event-streamand PHP can consumethem given a long-running runtime, but holding a connection open and reconnecting
it is infrastructure. This package maps entities.
Checks
165 tests, PHPStan level 8, php-cs-fixer. CI runs on 8.3, 8.4 and 8.5.