g10dra's Blog

Showing 6 to 7 of 7 blog articles.
  130752 views · 5 years ago

![Creating a URL shortener application in PHP & MySQL](https://images.ctfassets.net/vzl5fkwyme3u/3OjKfmylv2k8eWayqeCUWG/6d8e996fc7c757135df7fdd322fd50a4/AdobeStock_65694631.jpeg?w=1000)

Hi Guys,

In this post we will learn how to create your URL shortening application in PHP and MySQL.

You may also use this app as an API by calling the URLs from another application.

## Step 1: Creating a Table

```mysql

CREATE TABLE IF NOT EXISTS `url_shorten` (

`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,

`url` tinytext NOT NULL,

`short_code` varchar(50) NOT NULL,

`hits` int(11) NOT NULL,

`added_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP

) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

```

## Step 2: Create a file `index.php` and add database credentials in it

```php

$servername = 'localhost';

$username = 'root';

$password ...

  11983 views · 5 years ago

![Creating a Tiny Blog Management system in Laravel 5.7](https://images.ctfassets.net/vzl5fkwyme3u/7hiPly9aeW8i6IU0wkK4Gg/5b13c5fb7f273be44f44c87fb2ce5f5f/AdobeStock_205314257.jpeg?w=1000)

Hey There,

I am expecting you are familiar with PHP. In this post I will be using the Laravel framework to create a small blog system. I am showing here very simple steps to create blogs, If you want this complete code then please message me.

**What are major Prequisites for Laravel:**

* PHP version >= 5.6

* Composer should be installed in system

Create a project with name tiny_blog with following command

```composer create-project laravel/laravel --prefer-dist tiny_blog```

enter into the laravel project

```cd tiny_blog```

create a migration file using following artisan command

<pre>php artisan make:migration create_blog_table</pre>

After this command you will fou...