I recently tagged and released v6.0.0 and v6.1.0 of my Short URL package (ashallendesign/short-url).
In this Quickfire post, we're going to take a brief look at what's new and what's changed.
Customising the Short URL Prefix
Ryan Chandler made a contribution that added support for customising the prefix of the default short URL.
Previously, every short URL that was created used
/short as the prefix for the
default_short_url. For example, a typical short URL might have looked like this:
Now, you can change this prefix from
short to anything you'd prefer by changing the
prefix field in the
short-url.php config file. Using our previous example, if we updated the prefix in the config file to
/s, our URL would now look like this:
For more information, check out the original PR: #100
Forwarding Query parameters
Julien Arcin made a contribution that added support for forwarding query parameters sent in the request to the destination URL.
For example, let's say that you have the following short URL in your
Previously, if you were to go to
https://example.com/short/ABC123?paramOne=hello, you would be redirected to
However, by using the new query parameter forwarding feature, going to
https://example.com/short/ABC123?paramOne=hello would redirect you to
https://ashallendesign/blog?paramOne=hello. As you can see, the
paramOne=hello query parameter has been appended to the end of the destination URL.
To enable this feature, you can either set
true in the
short-url.php config file. Or, if you'd prefer to enable this feature on a case-by-case basis, you can use the
forwardQueryParams() method when building your short URLs like so:
1use AshAllenDesign\ShortURL\Facades\ShortURL;23ShortURL::destinationUrl('https://ashallendesign.co.uk/blog')4 ->forwardQueryParams()5 ->make();
For more information, check out the original PR: #94
Dropped older PHP and Laravel support
As part of the update to the v6.0.0 update, support for Laravel 6 and 7 was removed. Support for PHP 7.3 and 7.4 was also removed.
As a result of these changes, you must be using at least PHP 8.0 and Laravel 8 to use Short URL.
Hopefully, this post should have given you a brief overview of what's new in the Short URL package. You should also be able to see how we can customise the default short URL prefix and forward the user's query parameters.
If this post helped you out, I'd love to hear about it. Likewise, if you have any feedback to improve this post, I'd also love to hear that too.
If you're interested in getting updated each time I publish a new post, feel free to sign up for my newsletter below.
Keep on building awesome stuff! 🚀