shipfastlabs/agent-detector
Lightweight PHP utility that detects whether your code is running inside an AI agent or automated dev environment. Identify Claude, Cursor, Gemini, Codex and more via env vars or a standalone detectAgent() helper.
Adopt if:
AI_AGENT support, plus newly added agents like ZCode, Qwen Code, Crush, Windsurf, Zed Agent, Kiro IDE, Copilot cloud agent, and Jules).Look elsewhere if:
For Executives: *"This package lets us automatically detect AI agents (like GitHub Copilot, Claude, Replit, Cline, Goose, Windsurf, Zed Agent, Grok, Kimi, Qwen Code, Jules, and more) in our Laravel apps using simple environment variables. We can use this to:
For Engineers:
*"This is a zero-dependency, PHP 8.2+ library to detect AI agents via env vars (e.g., COPILOT_MODEL, CLAUDE_CODE). Key perks:
AgentDetector::detect()->isAgent.AI_AGENT env var or extend the KnownAgent enum.if (AgentDetector::detect()->knownAgent() === KnownAgent::Claude) {
// Enable Claude-specific optimizations
}
```*
*Alternatives*: Rolling your own env var checks or using heavier libraries like `browser-detect` (overkill for this use case)."*
How can I help you explore Laravel packages today?