danielebuso / shortener
Laravel 7 local url shortener
Installs: 2 811
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.1
- illuminate/support: ^7.0
Requires (Dev)
- orchestra/testbench: ^5.0
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-10-29 06:24:59 UTC
README
Local link shortener for Laravel 7
Installation
You can install the package via composer:
composer require danielebuso/shortener
Publish the migration and migrate
php artisan vendor:publish --tag=migrations php artisan migrate
Usage
$short_link = Shortener::shorten('https://example.com/my-very-long-link'); $short_link->short_url // Eg. https://myapp.com/l/JedO8TSC
Customize routing
To customize the link routing add the following to your routes and customize as you wish
Route::domain('mylink.com')->group(function () { Route::get('{short_link}', 'ShortLinkController@resolve')->name('short_link'); }); // Then in controller $short_link->short_url // Eg. https://mylink.com/JedO8TSC
Configuration
To customize the config either use the environment variables or publish the configuration file
php artisan vendor:publish --tag=config
Testing
composer test
Upcoming features
- Custom validity (nbf, exp)
- Link analitycs (times opened)
- Real tests
Security
If you discover any security related issues, please email daniele@kodesire.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.