Short URL package for Laravel applications


Short URL by Ash Allen is a Laravel package for creating short URLs in your Laravel applications. You can easily create a new short URL with the following code to get started:

1use AshAllenDesignShortURLClassesBuilder;

2 

3$builder = new Builder();

4 

5$shortURLObject = $builder->destinationUrl('https://destination.com')->make();

6$shortURL = $shortURLObject->default_short_url;

It’s up to you to configure and create short URLs around your existing data; for example, you can generate a short URL when a new post template is published.

This package provides all the basics and a bunch of advanced features to start making short, shareable URLs for your apps. Its main features include:

  • Custom URL keys
  • Single-use short URLs
  • Apply HTTPS
  • Configure redirect status code (302 found instead of permanent 301)
  • Make a short URL active and inactive on a certain date
  • Track visitors:
    • IP adress
    • Browser name
    • Browser version
    • Operating system name
    • Operating system version
    • Referrer URL (the original URL of the visitor)
    • Device type (can be: desktop / mobile / tablet / robot)

Here are other examples of using existing ShortURL template instances from the README file:

1use AshAllenDesignShortURLModelsShortURL;

2 

3// Find URL by key

4$shortURL = ShortURL::findByKey('abc123');

5 

6// Find by destination

7$shortURLs = ShortURL::findByDestinationURL('https://destination.com');

8 

9// Enable tracking to an existing short URL instance

10$shortURL->trackingEnabled();

11 

12// Get model properties, such as visits

13$shortURL = ShortURL::find(1);

14$visits = $shortURL->visits;

15 

16// Single-use short URL

17$builder = new AshAllenDesignShortURLClassesBuilder();

18 

19$shortURLObject = $builder

20 ->destinationUrl('https://destination.com')

21 ->singleUse()

22 ->make();

Learn more

You can learn more about this package, get full installation instructions, and view the source code on GitHub. The README contains comprehensive documentation with everything you need to configure and start interacting with short URLs.


Source link

Previous library launches LinkedIn Learning | Mirage News
Next The Circle Season 3 on the Cards: Find out why the streaming site URL showing circleus4?

No Comment

Leave a reply

Your email address will not be published. Required fields are marked *