thailv / robot-counter
Count and report how many times a bot visit your website
Requires
- jenssegers/agent: ^2.6
This package is auto-updated.
Last update: 2024-04-28 16:45:41 UTC
README
This package allow you to track how many bots visit your website, their frequency and time execution for each request.
Installation
In your project folder, run
composer require thailv/robot-counter
After finish, publish vendor by this command:
php artisan vendor:publish --provider="Thailv\RobotCounter\Providers\RobotCounterServiceProvider"
and php artisan migrate
to run migration file
Usage Instructions
This package works by using a middleware, logging every request performed by bots in a log file, you can rename the middleware in config/robots_counter.php
file.
If you want the middleware works for every request, just put its class \Thailv\RobotCounter\Http\Middleware\RobotCounterMiddleware::class
in array $middleware
in app/Http/Kernel.php
But the best practise is using this middleware for routes need reporting for better performance.
Also, you can config your accepted request methods you want to be in your log.
Push api to reporter to save log robot counter
Logs are saved to reporter by command robot-counter:report
, you can set schedule for run this command to push report every option time.
You can use it to make report for specific day, use php artisan robot-counter:report --help
to see usage.