Laravel Short URL Generator: Generate and expand short URL stored in a database

Recommend this page to a friend!
  Info   View files Documentation   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-10-29 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 26 This week: 1All time: 10,083 This week: 208Up
Version License PHP version Categories
laravel-short-url 1.0.0MIT/X Consortium ...5HTTP, PHP 5, Databases
Description Author

This package can generate and expand short URL stored in a database.

It provides a Laravel controller and service class that implement the action to create a short version of a given URL and stores it in a database.

The package also implements the action to handle the access to the short URL and redirect to the original URL that was previously stored in the database.

Picture of Moamen Eltouny
  Performance   Level  
Name: Moamen Eltouny <contact>
Classes: 14 packages by
Country: Egypt Egypt
Innovation award
Innovation award
Nominee: 8x

 

Details

<p align="center"><a href="https://pharaonic.io" target="_blank"><img src="https://raw.githubusercontent.com/Pharaonic/logos/main/short-url.jpg" width="470"></a></p>

<p align="center"> <a href="https://packagist.org/packages/Pharaonic/laravel-short-url"><img src="https://img.shields.io/packagist/v/RaggiTech/laravel-short-url" alt="Latest Stable Version"></a> <a href="https://packagist.org/packages/Pharaonic/laravel-short-url"><img src="https://img.shields.io/packagist/dt/Pharaonic/laravel-short-url" alt="Total Downloads"></a> <a href="https://packagist.org/packages/Pharaonic/laravel-short-url"><img src="https://img.shields.io/packagist/l/Pharaonic/laravel-short-url" alt="License"></a> </p>

Install

Laravel >= 8

Install the latest version using Composer:

$ composer require pharaonic/laravel-short-url
$ php artisan vendor:publish --tag=laravel-short-url
$ php artisan migrate

Usage

<a name="generate" id="generate"></a>

Generate (URL, Route)

// Generate from URL
shortURL()->generate('https://pharaonic.io');

// Generate from URL with Expiry date (string or Carbon object)
shortURL()->generate('https://pharaonic.io', '2027-07-07');



// Generate from Route
shortURL()->generate('route.name.here', ['param' => 1]);

// Generate from Route with Expiry date (string or Carbon object)
shortURL()->generate('route.name.here', ['param' => 1]', '2027-07-07');

<a name="read" id="read"></a>

Get URL

echo shortURL('3dc0c3deda')->url;    //      http://127.0.0.1:8000/8ca3522787

// Blade
@shortURL('3dc0c3deda')

<a name="expired" id="expired"></a>

IF Expired

shortURL('3dc0c3deda')->expired		// false

<a name="regenerate" id="regenerate"></a>

Re-Generate

shortURL('3dc0c3deda')->regenerate()		// Returns ShortURL Object

License

MIT LICENSE

  Files folder image Files  
File Role Description
Files folder imagesrc (5 files, 2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageconfig (1 file)
Files folder imagedatabase (1 directory)
  Accessible without login Plain text file Helper.php Aux. Short URL function
  Accessible without login Plain text file route.php Aux. Route script
  Plain text file ShortURL.php Class Class source
  Plain text file ShortURLController.php Class Class source
  Plain text file ShortURLServiceProvider.php Class Class source

  Files folder image Files  /  src  /  config  
File Role Description
  Accessible without login Plain text file short-url.php Aux. Auxiliary script

  Files folder image Files  /  src  /  database  
File Role Description
Files folder imagemigrations (1 file)

  Files folder image Files  /  src  /  database  /  migrations  
File Role Description
  Plain text file short-url.stub Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:26
This week:1
All time:10,083
This week:208Up

For more information send a message to info at phpclasses dot org.