mlopez/url-shortener is a Laravel package.
It currently has 0 GitHub stars and 6 downloads on Packagist (latest version v1.0.0).
Install it with composer require mlopez/url-shortener.
Discover more Laravel packages by mlopez
or browse all Laravel packages to compare alternatives.
Last updated
This package implements a URL shortener in your Laravel project, using a migration and two access routes. It also comes with a configuration file to adjust what you consider necessary.
Use composer to install the package.
composer require mlopez/url-shortener
Optionally, you can publish the configuration file and the migration.
php artisan vendor:publish --tag=url-shortener-migrations
php artisan vendor:publish --tag=url-shortener-config
After composer installs the package, run the following command to run the migration and register the routes.
php artisan url-shortene:install
public function test_url_shortener()
{
$this->post(route('links.store'), [
'long_url' => 'https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers'
]);
$this->assertDatabaseHas(config('urlshortener.table'), [
'long_url' => 'https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers'
]);
}
{
"id": 16,
"long_url": "https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers",
"code": "5TPcKQ",
"short_url": "https://123url.com/5TPcKQ", 🏹
"updated_at": "2023-03-25T04:59:32.000000Z",
"created_at": "2023-03-25T04:59:32.000000Z"
}
The MIT License (MIT). Please see License File for more information.