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 
The following two tabs change content below.

Chandra Shekhar

GCP Architect
Chandra Shekhar Pandey is Google certified Cloud engineer, I am Magento2 Trained developer. Having huge experience in designing cloud solution. I have around 12 years of experience with world enterprise IT companies and fortune 500 clients. During my architecture design I am always caring about high availability, fast performance and resilient system. From the programmer background I have huge experience in LAMP stack as well. Throughout my carrier I have worked on Retail, E-Learning, Video Conferencing and social media domain. The motive of creating cutehits was just to share the knowledge/solutions I get to know during my day to day life so that if possible I can help someone for same problems/solutions. CuteHits.com is a really a very effort for sharing knowledge to rest of the world. For any query/suggestion about same you can contact me on below details:- Email: shekharmca2005 at gmail.com Phone: +91-9560201363

Latest posts by Chandra Shekhar (see all)

You may also like...