kaantanis / url-tracker
Laravel URL Tracker
v1.0.0
2023-02-08 08:36 UTC
Requires
- php: ^8.1
- illuminate/contracts: ^9.0
- kaantanis/coderator: *
- spatie/laravel-package-tools: ^1.14.0
- spatie/laravel-referer: ^1.8
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-12-09 19:19:06 UTC
README
If a user create short url, this package will track the url and store the data in database.
Installation
You can install the package via composer:
composer require kaantanis/url-tracker
You can publish and run the migrations and config with:
php artisan install:url-tracker
This is the contents of the published config file:
return [ 'prefix' => 'url-tracker', // example.com/url-tracker/QSGHG2 'check-last-visit-minute' => 30 // check last 30 min same user visited this url. if not, increase view count ];
Usage
// Send post request to this url with tracked_url parameter // example.com/url-tracker/generate-url (route name is url-tracker.generate-url) Http::post(route('url-tracker.generate-url'), [ 'tracked_url' => 'https://google.com' ]); // This return a string url path like this with a unique code // example.com/url-tracker/QSGHG2 // If any visitor visit this url, user redirect to tracked_url // and visitor data will be stored in database
Which data will be stored in database?
// main table [ 'created_by' => auth()->id() ?? null, 'url' => $request->tracked_url, 'placeholder' => $uniqueCode ] // and log table [ 'url_tracker_table_id' => $urlFound->id, 'ip_address' => request()->ip(), 'user_agent' => request()->userAgent(), 'referer' => request()->headers->get('referer'), 'method' => request()->method(), ]
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.