Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Agents Detector

Laravel Agents Detector Laravel Package

pharaonic/laravel-agents-detector

Laravel Agents Detector identifies AI agents, bots, and crawlers visiting your Laravel app. Inspect incoming requests, detect known user agents, and use helpers or middleware to log, block, or customize responses for automated traffic.

View on GitHub
Deep Wiki
Context7

Laravel Agents Detector (Devices, Operation Systems, Browsers, Bots).

Frequently asked questions about Laravel Agents Detector
How do I install pharaonic/laravel-agents-detector?
Install it with Composer using composer require pharaonic/laravel-agents-detector. Laravel package auto-discovery should register the service provider; if your application does not use discovery, add the provider manually. Check the repository README for any publishable configuration or setup steps.
How can I detect AI agents and bots in Laravel requests?
The package inspects incoming request user agents and identifies known AI agents, bots, crawlers, devices, operating systems, and browsers. You can call its helpers from controllers, middleware, or listeners to check the current request. Use the detection results to log, block, or customize the response for automated traffic.
Can I block bots with middleware using this package?
Yes, the package is designed to support middleware-based handling for automated traffic. You can use its helpers in middleware to return a blocked response, such as a 403, when a request matches a bot or AI agent. Be careful to allow legitimate crawlers you still want to serve.
How do I log bot or crawler visits in Laravel?
Detect the request with the package helpers inside middleware or a request listener, then write the result to Laravel's log or a database table. Include useful context such as the matched agent type, user agent string, IP address, and requested path. The package identifies the traffic; your application decides where and how to store the record.
Which Laravel versions are supported by pharaonic/laravel-agents-detector?
The exact supported Laravel and PHP versions should be confirmed from the package's composer.json and README, because compatibility can change between releases. Check those requirements before installing in a new or legacy Laravel application. Testing on your target Laravel version is the safest way to confirm support.
Do I need to publish a config file for laravel-agents-detector?
Check the README to see whether the package ships a publishable configuration file. If it does, publish it with Laravel's vendor:publish command and adjust the settings for your detection or middleware behavior. If no config is published, use the package defaults through its helpers and middleware.
Is pharaonic/laravel-agents-detector production ready?
It is intended for inspecting real incoming requests, including bot and AI agent traffic, but production readiness depends on your risk tolerance. Review the repository's release activity, open issues, tests, and compatibility with your Laravel version. Add your own tests around blocking and logging rules before relying on it in production.
How does this compare to Laravel's built-in user agent handling?
Laravel gives you access to the raw user agent string, but it does not classify AI agents, bots, crawlers, devices, operating systems, and browsers for you. This package adds that detection layer plus helpers and middleware for handling automated traffic. Compare its maintained detection rules and features with other agent-detection packages before choosing.
Can I return a custom response for detected bots instead of blocking them?
Yes, detection does not have to mean blocking. Your middleware can return a custom status code, message, redirect, or alternative content when a bot or AI agent is detected. Use the package helpers to decide which agent types should receive the custom response.
How do I test bot detection in a Laravel app?
Write feature tests that send requests to your routes with User-Agent headers for known bots, AI agents, and normal browsers. Assert that your middleware logs, blocks, or customizes responses as expected for each case. You can also test the package helpers directly with representative user agent strings.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log