Short Url is a fantastic Laravel package that can be used for adding shortened URLs to your existing web app. Next, publish the package's config file and database migrations by the following command: php artisan vendor:publish --provider="AshAllenDesign\ShortURL\Providers\ShortURLProvider"

Example: $builder = new \AshAllenDesign\ShortURL\Classes\Builder(); $shortURLObject = $builder->destinationUrl('https://destination.com')->urlKey('custom-key')->make(); $shortURL = $shortURLObject->default_short_url; // Short URL: https://webapp.com/short/custom-key

If you want to override whether tracking is enabled or not when creating a shortened URL, you can use the ->trackVisits() method.

The example below shows how to enable IP address tracking for the URL and override the default config variable: $builder = new \AshAllenDesign\ShortURL\Classes\Builder(); $shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackIPAddress()->make(); Enforce HTTPS
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners