Laravel setup to localhost

 

Server Requirement : Prior to install Laravel we must need be ensure that you have below server configuration enabled.

  • PHP >= 5.6.4
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

Laravel installation : Its just a two step process.

    1. Copy the code base at the installation directory. You can do it either option.
      • Copy the code manually go to command line. Traverse to your document root (by using cd command) and run the command
        composer install 
      • Through command line (there are multiple projects available on github that you can directly make use of)
         composer create-project --prefer-dist laravel/laravel laratest 

        Here laratest is the project folder name.
        Create-project command will install the laravel in specified directory.

    2. Now just reach to same directory by running command
 php artisan serve

You are all set :) You will see the your application URL on the cmd itself. Just go to that URL and get the running application on your browser.

Make sure you run all your command on your document root only.

 

 

Database connection to laravel installation

  •  Update database credentials to your application:

Open your .env file on the document root and update the database credentials there.

 

DB_CONNECTION=mysql

DB_HOST=127.0.0.1

DB_PORT=3306

DB_DATABASE=DBNAME

DB_USERNAME=DBUSERNAME

DB_PASSWORD= DBPASSWORD
  • Database migration command in laravel:

If you are running an application that already have the database driven then there are two step process to import the database in your dev/production environment.

 

  1. Database migration (to import the database architecture): Command to db migration is as below
     php artisan migrate 
  2. Database seeding (to import the database values into the database): command to do db seeding is
     php artisan db:seed 

Related posts:

The following two tabs change content below.

Chandra Shekhar

Consultant at Infogain
Chandra Shekhar is a LAMP Developer,Thinker,Blogger and currently working as Magento(Ecommerce) specialist.. I am always open to learn new things in LAMP as well as other newer technology. In the journey of my last 9 years of web and product development, I have decided to share my knowledge and experience to Open Source Community in 2011. In this regard I have started CuteHits.com. Since then I am actively sharing my knowledge on various LAMP technology through CuteHits.com’s technical ... Read More about Chandra Shekhar

Latest posts by Chandra Shekhar (see all)