Streaming LLM responses with Laravel Reverb
Polling made our chat feel like a fax machine. Here is the WebSocket setup that puts the first token on screen in 300 ms, and the two mistakes that cost me a weekend.
Field notes on shipping LLM features with PHP: queues, streaming, evals, and the incidents that taught me each of them. A new post every other Thursday.
composer require laravel/reverb
php artisan install:broadcasting
php artisan reverb:start
php artisan queue:work --tries=3
Polling made our chat feel like a fax machine. Here is the WebSocket setup that puts the first token on screen in 300 ms, and the two mistakes that cost me a weekend.
A prompt change is a deploy. Forty lines of Pest that catch regressions before your users do.
We put 20,000 embedding jobs on Horizon and met our provider's limits within a minute.
You do not need a vector database yet. One migration, one scope, and a cosine operator.
Timeouts, heartbeats and the one config key I had wrong for three years.
Components, slots and escaping are exactly what a prompt needs. Strings in a service class are not.
Semantic cache keys, a boring Redis instance, and the dashboard that made the case.
About the author
Backend developer in Leipzig. Ten years of Laravel, two of putting language models into products people pay for. I write down what broke so you can skip it.