Integrating Claude in a PHP app is simpler than it looks, but doing it right for production requires avoiding a few pitfalls.

Minimal client

No official PHP SDK but guzzlehttp/guzzle is enough.

Prompt caching

Reduces costs up to 90% on repeated prompts. 5-minute TTL.

Streaming

Essential for good UX.

Tool use

Give Claude the ability to call PHP functions.

Security

Never ship the API key to the client. Always proxy server-side.