laravel/agent-detector
Lightweight PHP/Laravel utility to detect when your code runs inside an AI agent or automated dev environment. Detect via AgentDetector::detect() or detectAgent(), identify known agents like Cursor, Gemini, Codex, Claude, or custom via env vars.
env vars or filesystem checks) when this package offers maintained, extensible coverage.Adopt if:
AI_AGENT env var).Look elsewhere if:
*"This package lets us automatically detect AI agents (like Copilot or Claude) in our Laravel apps with zero code changes. We can use it to:
*"This solves a growing pain point: distinguishing between human and AI-driven interactions in PHP/Laravel. Key benefits:
AI_AGENT=your-tool—no forks needed.SECRET_KEY logs in automated environments.if (detectAgent()->knownAgent() === KnownAgent::Copilot) {
// Customize UI/CLI for Copilot users
}
No reinventing the wheel—just drop it into composer.json and start detecting."*
*"This enables us to segment AI vs. human interactions in our telemetry. For example:
How can I help you explore Laravel packages today?