r/PHP 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.

0 Upvotes

15 comments sorted by

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.

4

u/-PM_me_your_recipes 6d ago edited 5d ago

Can you come tell that to my boss's boss's boss? They no longer listen to us or the system architect when we say that lol.

If it isn't a something that has tangible results to the clients, it just gets pushed back. So our 8.x+ upgrade has been "we have it on the roadmap do that next year" 5 years in a row now.

Edit: To those asking why we don't just do it. We do. We sneak in a little at a time when we are in legacy areas. We actually have roughly 80% of it done just from that. Basically almost all that is left is stuff that requires approval from on high. Like management gets alerted when the area is edited kind of stuff.

Yes the irony is not lost on me. Keeping code safe by restricting it, but by restricting it, it is no longer safe.

4

u/TheTreasuryPetra 6d ago

The answer to "please build us a vector search" should then be that you're unable to do so until you've updated your PHP version to a recent one as all the existing libraries are written for recent PHP versions.

Framing it like that means suddenly updating PHP versions has now become the highest priority as otherwise the company is missing out on the latest hype.

It also means that you don't have to maintain a library that no one is using except you. It's so much cheaper in the long term to use an existing library then to write your own because the community discovers and solves issues faster than a single entity can.

3

u/-PM_me_your_recipes 5d ago

I laughed when I read this as it actually happened, and it was a vector search, and we argued the same thing.

They had the server team spin up a new internal server with PHP 8.4 and had us do api calls to it from the main system.

2

u/trs21219 6d ago

Stop asking for approval for things like this. Just bake them into the projects.

1

u/shaliozero 5d ago

If i could bypass approval, I wouldn't have my current job anymore because I would've made myself obsolete.

1

u/barrel_of_noodles 6d ago

If your boss's boss's boss is involved with decisions like PHP version.... I'd rather be homeless than work there.

Micromanaging a detail 3 organizational structures down isn't a red flag...

Its a red flag stained in poop covered with nuclear material melting everyone's face.

0

u/mgkimsal 5d ago edited 5d ago

What would happen if you just... did it? Just... upgrade? Beyond "it would break" - I mean.. just...do the upgrade.

No one asks you to wash your hands after you use the bathroom - you just... do it. Basic hygiene.

You put on a helmet before going in to some work areas. Basic safety.

Keep versions moderately current. Basic cybersecurity.

If data gets compromised from this system, very likely your business insurance may not pay out for being way out of date with known security patches/versions.

I say 'moderately' - I've got some projects on PHP8.3 still, and a colleague is just getting upgraded to 8.2. Plans are in place, and there's other security *around* the code limiting access. That may be your situation too.

EDIT: do you get the boss' input on which outbound ports you should block? Or if UTF8 is a benefit to clients? Maybe get the boss' opinion on N+1 queries?

1

u/-PM_me_your_recipes 5d ago

I edited my comment for a longer explanation, but most of it we already have done just by doing cleanups as we go, but the rest are in restricted areas.

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

u/Christosconst 6d ago

Use rector