can I use algolia for this?
It should be straight forward to add search to a firebase database with Algolia.
We document it here: https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/tutorials/firebase-algolia/
The tutorial is written for NodeJS but there everything you need to easily adapt it for a PHP stack.
Our API works both in PHP and JS. https://www.algolia.com/doc/api-client/getting-started/install/php/
I hope this helps.