-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP - support latest version, add typehint, add static checks, and add tests #53
base: master
Are you sure you want to change the base?
Conversation
@bepsvpt I appreciate the PR, but we are unfortunately unable to entertain a full rewrite of the library, because we want to maintain consistency in the code layout between all the language libraries we officially maintain. |
what do you mean with "consistency in the code layout between all the language libraries"? different languages use a different standard in the project structure, which helps developers keeping their processes lean when dealing with multiple libraries. I do not see a blocker introducing static-code analysis (Phpstan or PSalm) and strict-types, and tests is a blocking issue. |
I'd be down to accept a PR to add types, and any static analysis tools, to the existing library. What I meant was, I'd not be down to change the internal file structure and method parameter signatures, to reduce maintenance overhead as we add new features. |
I see your point, but I still believe that the current implementation is still leading to headaches. An example is: how do you know if a collection exists? (this is just one of the examples I found out): Try 1:$this->client->getCollections()['collection_name];
Does not work, as the collection is always returned/generated even if it does not exist on the server. Try 2:$this->client->getCollections()->offsetExists('collection_name'); this is always false if the API is not yet called under the hood Try3:$this->client->getCollections()->retrieve();
// Then one of the (1) or (2) abve Nope, the API call is invoked, but the results not used to populate the collection Try4 - conter intiutive (IMO)$this->client->getCollections()['collection_name]->retrieve()`
Additional notes:I believe there is a very low DX with this client, which should be tackled IMO how can we help to make the PHP client better? |
The actual method call to retrieve a collection is: $client->collections['companies']->retrieve(); Essentially Documented under the PHP tab in the docs: https://typesense.org/docs/0.25.2/api/collections.html#retrieve-a-collection It's been a long time since I wrote production-level PHP, but is that not idiomatic PHP? |
Pull Request Not Yet Completed
Feel free to provide any ideas and suggestions.
This Pull Request completely reworks this package to achieve the following goals:
Implemented APIs:
Documentation:
To be supplemented...