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.
- 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.
- Copy the code manually go to command line. Traverse to your document root (by using cd command) and run the command
- 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.
- Database migration (to import the database architecture): Command to db migration is as below
php artisan migrate
- Database seeding (to import the database values into the database): command to do db seeding is
php artisan db:seed
Related posts:
Chandra Shekhar
Latest posts by Chandra Shekhar (see all)
- Best practices for micro service design - January 23, 2022
- Spring Boot - January 23, 2022
- Java - January 23, 2022
Recent Comments