shipfastlabs/agent-detector
Lightweight Laravel/PHP utility to detect when your code is running inside an AI agent or automated dev environment. Supports multiple known agents (e.g., Cursor, Gemini, Codex, Claude) via environment-variable detection. Requires PHP 8.2+.
Adopt if:
AI_AGENT support).Look elsewhere if:
For Executives: *"This package lets us automatically detect AI agents (like GitHub Copilot, Claude, or Replit) 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?