URL shortener web application
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.




This is a PHP web application to shorten long URL. It is inspired by web application such as http://bit.ly or http://goo.gl.


It has 2 features:

  1. Retrieve short URL from given URL. If it cannot find it in database, create new short URL from given URL.
  2. Retrieve original URL using short URL and then redirect to original URL.


  • HTTP GET on http://[a domain name]/ will display main page with form to add a short URL.
  • HTTP POST on http://[a domain name]/ will handle adding short URL request, validate data and retrieve short URL. If no short URL found, then create new one and add it to database.
  • HTTP GET on http://[a domain name]/{short_url_code} will retrive short_url_code, validates it and then retrieve original URL and redirect to it.


  • Clone this repository and then cd urlshort/urlshort
  • Make sure you have Composer installed somewhere.
  • Run composer install to install all software packages dependencies.
  • Create a virtual host on your web server then point public directory as Document Root.
  • Rename .env.sample file to .env file
  • From shell run php artisan app:key to generate application key (see APP_KEY in .env file)
  • Create a MySQL database and user that has priviledge to basic CRUD, and create table.
  • Edit .env file and change DB_HOST, DB_DATABASE, DB_USERNAME, DB_PASSWORD according to your database configuration.
  • From shell run php artisan migrate:install to setup table.
  • From shell run composer dumpautoload to generate autoload file (optional).


Application is built on top of Laravel framework 5.2. Application UI use Bootstrap.

That's it. If you add new features, please feel free to submit PR.

Zamrony P. Juhara zamronypj@yahoo.com @zpjuhara