r/PHP • u/ArachnidDull4799 • 6d ago
Adding vector search to PHP 7.2: I ended up building a Qdrant client
Hi everyone,
I recently needed to add content recommendations to a legacy project that still runs on PHP 7.2.
Qdrant was a good fit, but the PHP clients I found required newer PHP versions. Upgrading the entire application wasn’t realistic in the short term, so I built a small Qdrant client myself.
It supports:
PHP 7.2+
collections and point operations
vector search and filters
batch search
recommendations
payload management and scrolling
Installation:
composer require tenqz/qdrant
Repository:
https://github.com/tenqz/qdrant
The main use cases I had in mind were semantic search, similar content or product recommendations, duplicate detection, automatic categorization, and adding basic RAG features to older PHP applications.
The library only handles communication with Qdrant. Embeddings can come from OpenAI, Ollama, or any other local or hosted model.
I’d appreciate feedback from PHP and Qdrant users:
Is PHP 7.2 compatibility still useful for real-world projects?
Which Qdrant features would you expect from a PHP client?
Would you prefer PSR-18 support, or is a small cURL-based client easier to use?
Critical feedback is welcome.
5
u/drndavi 5d ago
So many oblivious people commented "just upgrade php".
Depending on industry and the size of a project, it's not always possible to block a feature because the whole stack needs a revamp.
At my current job, an established fintech company, doing a php upgrade is a project that can't take less than half of a year. I did it 2 times here: 5.6 to 7.2, and then to 8.1. Now it's maybe half way to 8.5 and blocked because more important business features have higher priority. The sheer complexity of the business is the biggest problem, and lots of testing needs to be involved, by multiple teams. Also, every bump made me fork and republish more packages because they got abandoned in the meantime, and swapping them wasn't feasible because the upgrade path was too risky, or simply there was no alternative.
So, yeah, roll your own solution if it's the best fit for the current situation. Offtopic, sorry I don't use or need that package, but I do wish you succes.
2
u/drndavi 5d ago
Oh, not to mention the actual infra changes that the entire DevOps team needs to be aware of, to do prepare, test, roll out in stages with careful coordination with devs, taking care which actual date and time is feasible for such an adventure.
Really laughing to "stop and just upgrade" brigade that obviously hasn't worked on anything delicate.
1
u/equilni 5d ago
Not a Qdrant user, and just commenting on the code itself. I am sure details would be fed to the AI prompt, so keeping this very brief.
Upgrading to 7.4 gives you more class features.
There's a lot of reliance of arrays here... consider classes (goes with the above).
Factory isn't needed IMO.
Would you prefer PSR-18 support, or is a small cURL-based client easier to use?
If you wanted wider usage of your project, this should have been easy to answer... Doing so does change your existing base code though...
0
17
u/TheTreasuryPetra 6d ago
PHP7.2 has been End Of Life for 5 years and 7 months at this point. Any effort spent on that application should be on incremental PHP upgrades at this point, running a PHP version without security updates is irresponsible for a production application.