Releases: ash-jc-allen/short-url
Short URL v4.0.0
Short URL v4.0.0
New Features
Added optional config validation (#50)
Up until now, the values defined in the short-url.php
config file were always validated. However, this sometimes caused issues if the application's config was cached before running composer require
. A new config variable has been added which can now be used to toggle whether if the validation should be run. By default, the validation is now disabled.
To enable the validation, you can add the following line to your short-url.php
config file:
'validate_config' => true,
Dropped Laravel 5.8 support (#51)
As of Short URL v4.0.0, Laravel 5.8 is no longer supported. Therefore, you must be using a minimum of Laravel 6.0 to use this library.
Removed the ShortURLBuilder
facade (#53)
The ShortURLBuilder
facade was deprecated in v3.0.0 to fit more with the Laravel naming conventions and standards. As of Short URL, v4.0.0 the ShortURLBuilder
facade has now been removed in favour of a newer ShortURL
facade.
Short URL v3.0.0
Short URL v3.0.0
New Features
- Added functionality to specify activation and deactivation times for short URLs
- Deprecated the
ShortURLBuilder
facade in favour of a newShortURL
facade
Added functionality to specify activation and deactivation times for short URLs (#46)
Up until now, by default, all short URLs that are created are active until you delete them. However, you are now able to set activation and deactivation times for your URLs when creating new ones.
Doing this can be useful for marketing campaigns. For example, you may want to launch a new URL for a marketing campaign on a given date and then automatically deactivate that URL when the marketing campaign comes to an end.
The example below shows how to create a shortened URL that will be active from this time tomorrow onwards and then is deactivated the day after:
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->activateAt(\Carbon\Carbon::now()->addDay())
->deactivateAt(\Carbon\Carbon::now()->addDays(2))
->make();
Deprecated the ShortURLBuilder
facade in favour of a new ShortURL
facade (#45)
Up until now, you could use the ShortURLBuilder
facade to create a new short URL. However, to make the package fit more with the Laravel naming conventions and consistency, this has now been deprecated.
There is now a newer ShortURL
facade which you can use. It works exactly the same and is purely being changed for syntactic sugar.
Note: The ShortURLBuilder
will remain in version 3.* of the library but will be removed in version 4.0.0.
Short URL v2.3.1
Short URL v2.3.1
New Features
Updated documentation (#43)
The documentation has now been updated to let developers know that they will require the BC Math or GMP PHP extensions.Short URL v2.3.0
Short URL v2.3.0
New Features
Added support for Laravel 7 (#38)
Short URL now has support for Laravel 7!
Credits: Thanks innoflash for the pull request!
Updated the asset publishing tags (#39)
Previously, the tags for publishing the migrations and config assets for the package were: config
and migrations
. These have now been updated to short-url-config
and short-url-migrations
to be less generic.
Credits: Thanks innoflash for the pull request!
Short URL v2.2.0
Short URL v2.2.0
New Features
Added a default config option to enforce HTTPS on the destination URL (#36)
Credits: Thanks Carlos A. Escobar for the pull request for this feature!
Up until now, the 'secure' option was enabled by default for all URLs that were created. This meant that unless the ->secure(false)
method was explicitly used when creating the short URL, all URLs would redirect to the HTTPS version of the destination URL.
This option can now be defined in the config with the enforce_https
field. This field will default to true in the config included with the package. To override this and set your own option, add the following snippet to your
short-url.php
config file:
/*
|--------------------------------------------------------------------------
| Enforce HTTPS in the destination URL
|--------------------------------------------------------------------------
|
| Here you may specify if the visitor is redirected to the HTTPS
| version of the destination URL by default. This option can be
| overridden when creating the short URL with the ->secure()
| method.
|
*/
'enforce_https' => true,
Short URL v2.1.0
Short URL v2.1.0
New Features
Added the key salt as a config option (#32)
Up until now, the salt (that was used by an underlying package for generating the unique short URL keys) was defined as a constant in the ``` AshAllenDesign\ShortURL\Classes\KeyGenerator ``` class. It can now be defined in the config with the ``` key_salt ``` field.To set your own key salt, add the following snippet to your short-url.php
config file:
/*
|--------------------------------------------------------------------------
| Key Salt
|--------------------------------------------------------------------------
|
| Define the salt that is used to create the unique short
| URL keys. This is used to ensure that the randomly
| generated keys are unique.
|
*/
'key_salt' => 'YOUR SALT HERE',
ShortURL v2.0.0
Short URL v2.0.0
New Features
- Added referer URL tracking options
- Added device type tracking options
- Added functionality to set the tracking options for individual short URLs.
- Added functionality to set the redirect status code for individual short URLs
- Added a
ShortURLVisited
event. - Added
trackingEnabled()
helper method - Added
trackingFields()
helper method
Added referer URL tracking options (#26)
There is now a new tracking option for the short URLs that allows you to track the referer URL of the visitor. For example, if the short URL is placed on a web page with URL ``` https://domain.com/page-name ```, that URL will be recorded if the referer URL tracking is enabled.If you want to override the default config option of whether if referer URL tracking is enabled or not when creating a shortened URL, you can use the ->trackRefererURL()
method.
The example below shows how to enable referer URL tracking for the URL and override the default config variable:
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackRefererURL()->make();
Added device type tracking options (#27)
There is now a new tracking option for the short URLs that allows you to track the device type of the visitor. There are four possibilities of device type: ``` mobile ```, ``` desktop ```, ``` tablet ```, ``` robot ```. This can be particularly useful for analytical purposes.If you want to override the default config option of whether if device type tracking is enabled or not when creating a shortened URL, you can use the ->trackDeviceType()
method.
The example below shows how to enable device type tracking for the URL and override the default config variable:
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackDeviceType()->make();
Added functionality to set the tracking options for individual short URLs (#29)
Up until now, the tracking options were set in the config and affected all new and existing short URLs. In this release, the tracking options in the config are now used for defining the defaults. These values can now be overridden when creating your short URLs.Updating the tracking options in the config now won't affect the new short URLs that are created.
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();
Learn more about setting the tracking options in the README.
Added functionality to set the redirect status code for individual short URLs (#25)
Up until now, all short URLs have redirected (if using the package's provided controller) with a 301 HTTP status code. But, this can now be overridden when building the shortened URL using the ``` ->redirectStatusCode() ``` method.The example below shows how to create a shortened URL with a redirect HTTP status code of 302:
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
$shortURLObject = $builder->destinationUrl('http://destination.com')->redirectStatusCode(302)->make();
Added a ShortURLVisited
event (#24)
Each time a short URL is visited, the following event is fired that can be listened on:
AshAllenDesign\ShortURL\Events\ShortURLVisited
This is useful for if you want to trigger some code via listeners whenever a short URL is visited without needing to override the package's provided controller.
Added trackingEnabled()
helper method (#30)
To check if tracking is enabled for a short URL, you can use the ->trackingEnabled() method. It will return true if tracking is enabled, and false if not.
The following example shows how to check if a short URL has tracking enabled:
$shortURL = \AshAllenDesign\ShortURL\Models\ShortURL::first();
$shortURL->trackingEnabled();
Added trackingFields()
helper method (#30)
To check which fields are enabled for tracking for a short URL, you can use the ->trackingFields() method. It will return an array with the names of each field that is currently enabled for tracking.
The following example shows how to get an array of all tracking-enabled fields for a short URL:
$shortURL = \AshAllenDesign\ShortURL\Models\ShortURL::first();
$shortURL->trackingFields();