I’m wiring up an anonymous chat feature for my WordPress site and already have the front-end ready. What I need from you is the complete PHP back-end that talks to Firebase Realtime Database and keeps everything fast, secure, and scalable. Core requirements • Anonymous login only – no email or social accounts involved. • Real-time messaging handled through Firebase Realtime Database. • Built-in user blocking, message encryption (end-to-end preferred), and searchable message history. • Architecture that can scale horizontally without rewriting code; clean separation so I can drop the PHP classes or a small REST layer into any WordPress installation via a plugin. • Well-commented code plus a short README covering setup, environment variables (Firebase keys, secret salts, etc.), and example endpoints/hooks. Acceptance criteria 1. I plug the code in as a WP plugin, add my Firebase keys, and anonymous users can start a one-to-one or group chat instantly. 2. Messages arrive in real time across multiple browser tabs without manual refresh. 3. Blocking a user prevents further messages from that user for both parties. 4. Messages are encrypted at rest and in transit; you’ll include the PHP encryption helper and show where key management occurs. 5. History retrieval is paginated and stays under 200 ms for 10,000+ messages in testing. 6. No console or PHP error notices in WP_DEBUG true mode. Preferred stack/tools PHP 8.x, Firebase PHP SDK, WordPress REST API hooks, Composer for dependencies, and Git for version control. Hand me the finished back-end code and the concise setup guide, and I’ll handle the UI integration from there.